Skip to content
This repository was archived by the owner on Jul 24, 2021. It is now read-only.
This repository was archived by the owner on Jul 24, 2021. It is now read-only.

AttributeError: 'Response' object has no attribute 'json' #33

@horsey2014

Description

@horsey2014

=== I just installed onedrive-cli but every command I make comes up with the following error:
AttributeError: 'Response' object has no attribute 'json'

=== For example:
$ onedrive-cli auth
Visit the following URL in any web browser (firefox, chrome, safari, etc),
authorize there, confirm access permissions, and paste URL of an empty page
(starting with "https://login.live.com/oauth20_desktop.srf") you will get redirected to in the end.
Alternatively, use the returned (after redirects) URL with "/usr/local/bin/onedrive-cli auth " command.

URL to visit: https://login.live.com/oauth20_authorize.srf?scope=wl.skydrive+wl.skydrive_update+wl.offline_access&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&response_type=code&client_id=0000000048xxxxxx

URL after last redirect: https://login.live.com/oauth20_desktop.srf?code=xxxxxxxx-aed1-11e0-b4be-xxxxxxxxxxxx&lc=xxxx
Traceback (most recent call last):
File "/usr/local/bin/onedrive-cli", line 9, in
load_entry_point('python-onedrive==14.11.0', 'console_scripts', 'onedrive-cli')()
File "/usr/local/lib/python2.7/dist-packages/onedrive/cli_tool.py", line 263, in main
api.auth_get_token()
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 539, in auth_get_token
ret = super(PersistentOneDriveAPI, self).auth_get_token(_argz, *_kwz)
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 238, in auth_get_token
res = self.auth_access_data_raw = self._auth_token_request()
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 271, in _auth_token_request
return self.request(self.auth_url_token, method='post', data=post_data)
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 173, in request
res = res.json()
AttributeError: 'Response' object has no attribute 'json'

=== Here is my .lcrc, it seemed to have put the auth code into the .lcrc correctly. I don't know if I should put the "-MG1SRN" after the secret but it did not seem to matter either way.
auth:
code: xxxxxxxx-aed1-11e0-b4be-xxxxxxxxxxxx
client:
id: 0000000048xxxxxx
secret: xxxxgGtrgkbbx5n3xbxxxxxxxxxxxxx-MG1SRN

=== Since the .lcrc looked correct I tried the quota command and also get the same error:
$ onedrive-cli --debug quota
DEBUG:onedrive.api_v5:Requesting new access_token through authorization_code grant
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): login.live.com
DEBUG:requests.packages.urllib3.connectionpool:"POST /oauth20_token.srf HTTP/1.1" 400 127
Traceback (most recent call last):
File "/usr/local/bin/onedrive-cli", line 9, in
load_entry_point('python-onedrive==14.11.0', 'console_scripts', 'onedrive-cli')()
File "/usr/local/lib/python2.7/dist-packages/onedrive/cli_tool.py", line 267, in main
df, ds = map(size_units, api.get_quota())
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 502, in get_quota
super(OneDriveAPI, self).get_quota()))
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 357, in get_quota
return self('me/skydrive/quota')
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 349, in call
self.auth_get_token()
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 539, in auth_get_token
ret = super(PersistentOneDriveAPI, self).auth_get_token(_argz, *_kwz)
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 238, in auth_get_token
res = self.auth_access_data_raw = self._auth_token_request()
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 271, in _auth_token_request
return self.request(self.auth_url_token, method='post', data=post_data)
File "/usr/local/lib/python2.7/dist-packages/onedrive/api_v5.py", line 173, in request
res = res.json()
AttributeError: 'Response' object has no attribute 'json'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions