get_login_data
- FunctionalityWrapper.get_login_data(style='dict', anon=False)[source]
Returns the login data as dict or url. What the returned value looks like is depending on style and the anonymous user or registered user depending anon.
- Parameters:
style ({'dict', 'url'}, default 'dict') –
- ‘dict’:
returns a dict with keys host, port, user and passwd or only host and port
- ’url’:
returns a url containing the the login data
anon (bool) –
- True:
returns the login data for the anonymous user
- False:
returns the login data for the registered user
- Returns:
login_data – Login data as dict or url, depending on the value of style.
- Return type:
dict, str
- Raises:
TypeError – If style is not a
strTypeError – If anon is not a
boolValueError – If the value of style is not ‘dict’ or ‘url’
Examples
>>> ftpserver.get_login_data() {"host": "localhost", "port": 8888, "user": "fakeusername", "passwd": "qweqwe"}
>>> ftpserver.get_login_data(anon=True) {"host": "localhost", "port": 8888}
>>> ftpserver.get_login_data(style="url") ftp://fakeusername:qweqwe@localhost:8888
>>> ftpserver.get_login_data(style="url", anon=True) ftp://localhost:8888