You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to adjust the prepare() method to handle all the exceptional cases. In particular, there's a difference between an empty password, None for a password, and a wrong password -- even when accessing public datasets:
>>> list(osfclient.OSF(username='', password=None).project('fg8jy').storage().files)[0].name
'README.md'
>>> list(osfclient.OSF(username='', password='').project('fg8jy').storage().files)[0].name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/api.py", line 24, in project
return Project(self._json(self._get(url), 200), self.session)
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/models/core.py", line 23, in _get
return self.session.get(url, *args, **kwargs)
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/models/session.py", line 45, in get
raise UnauthorizedException()
osfclient.exceptions.UnauthorizedException
>>> list(osfclient.OSF(username='', password='afdsfs').project('fg8jy').storage().files)[0].name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/api.py", line 24, in project
return Project(self._json(self._get(url), 200), self.session)
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/models/core.py", line 60, in _json
status_code))
RuntimeError: Response has status code 502 not (200,)
>>> list(osfclient.OSF(username='sdfiljsdofj', password='afdsfs').project('fg8jy').storage().files)[0].name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/api.py", line 24, in project
return Project(self._json(self._get(url), 200), self.session)
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/models/core.py", line 23, in _get
return self.session.get(url, *args, **kwargs)
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/models/session.py", line 45, in get
raise UnauthorizedException()
osfclient.exceptions.UnauthorizedException
>>> list(osfclient.OSF(username='sdfiljsdofj', password='').project('fg8jy').storage().files)[0].name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/api.py", line 24, in project
return Project(self._json(self._get(url), 200), self.session)
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/models/core.py", line 23, in _get
return self.session.get(url, *args, **kwargs)
File "/home/kousu/.local/lib/python3.6/site-packages/osfclient/models/session.py", line 45, in get
raise UnauthorizedException()
osfclient.exceptions.UnauthorizedException
The text was updated successfully, but these errors were encountered:
We need to adjust the
prepare()
method to handle all the exceptional cases. In particular, there's a difference between an empty password,None
for a password, and a wrong password -- even when accessing public datasets:The text was updated successfully, but these errors were encountered: