goodreads-api-client-python icon indicating copy to clipboard operation
goodreads-api-client-python copied to clipboard

Error when using OAuth

Open pietermarsman opened this issue 8 years ago • 1 comments

I get this error when I try to do gr.Client(developer_key=config['key'], developer_secret=config['secret']).authorize()

Traceback (most recent call last):
  File "/Users/pieter/.virtualenvs/data_gatherer/lib/python3.6/site-packages/rauth/service.py", line 21, in process_token_request
    return tuple(data[key] for key in args)
  File "/Users/pieter/.virtualenvs/data_gatherer/lib/python3.6/site-packages/rauth/service.py", line 21, in <genexpr>
    return tuple(data[key] for key in args)
KeyError: 'oauth_token'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/pieter/.virtualenvs/data_gatherer/lib/python3.6/site-packages/luigi/worker.py", line 194, in run
    new_deps = self._run_get_new_deps()
  File "/Users/pieter/.virtualenvs/data_gatherer/lib/python3.6/site-packages/luigi/worker.py", line 131, in _run_get_new_deps
    task_gen = self.task.run()
  File "/Users/pieter/Documents/Projects/data_gatherer/tasks/goodreads.py", line 22, in run
    client.authorize()
  File "/Users/pieter/.virtualenvs/data_gatherer/lib/python3.6/site-packages/goodreads_api_client/client.py", line 36, in authorize
    self._transport.authorize()
  File "/Users/pieter/.virtualenvs/data_gatherer/lib/python3.6/site-packages/goodreads_api_client/transport.py", line 58, in authorize
    self.gr.get_request_token(header_auth=True)
  File "/Users/pieter/.virtualenvs/data_gatherer/lib/python3.6/site-packages/rauth/service.py", line 244, in get_request_token
    process_token_request(r, decoder, key_token, key_token_secret)
  File "/Users/pieter/.virtualenvs/data_gatherer/lib/python3.6/site-packages/rauth/service.py", line 24, in process_token_request
    raise KeyError(PROCESS_TOKEN_ERROR.format(key=bad_key, raw=r.content))
KeyError: "Decoder failed to handle oauth_token with data as returned by provider. A different decoder may be needed. Provider returned: b'Invalid OAuth Request\\n<!-- This is a random-length HTML comment: xlgczchcxzeqfdtjnladzpvyawdqlbihcvitnecowfovtiowpjvseusitimzdugwufdeaiqbeavcppgnfeggasxqfkmmoxxswshvytlbzvalxognnxrqisofqvgvabwgftmcpecxothubzquuitxxvtkffmralldsdabpkvrnmwpduxyotvzzpoelvmdeuprvkkbwtbdomfvjhspdhcfmyzlqzeaiklftjlyijixibevemjipgztgvssrqeyfhvjpdmbykubeyjylswnbtkjadvxbndosqbswrzijs -->'"

pietermarsman avatar Jan 07 '18 14:01 pietermarsman

In my experiments, the only way I didn't get this error was by setting the base address to "https://www.goodreads.com", so it seems like the fix would be in the Transport class, as well as updating documentation in Transport and Client

teusday avatar Jan 21 '18 15:01 teusday