Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication Timeout error #21

Open
tesserata opened this issue Sep 19, 2017 · 0 comments
Open

Authentication Timeout error #21

tesserata opened this issue Sep 19, 2017 · 0 comments

Comments

@tesserata
Copy link

tesserata commented Sep 19, 2017

#I'm trying to use start_authorization_code_flow() to authorise (I need to have access to my documents)
The code is the following:

from mendeley import Mendeley
from requests import post, get, session

secret = '<secret>'
app_id = '<id'>
redirect_uri = 'mendeley.com'

sdk = Mendeley(app_id, secret, redirect_uri)
auth = sdk.start_authorization_code_flow()
credentials = {'username': '<username>', 'password': '<password>'}

s = session()
login_url = auth.get_login_url()
login = s.post(login_url, credentials)

Then s.post(login_url, credentials) returns a timeout error. Same if I just copy the login url and try to manually log in with browser.
However, if I'm trying to use start_client_credentials_flow() method, everything is well.

Traceback follows

<ipython-input-73-86dcfcea52de> in <module>()
----> 1 login = s.post(login_url, credentials)
/home/belyaevadg/anaconda3/lib/python3.6/site-packages/requests/sessions.py in post(self, url, data, json, **kwargs)
    502         """
    503 
--> 504         return self.request('POST', url, data=data, json=json, **kwargs)
    505 
    506     def put(self, url, data=None, **kwargs):

/home/belyaevadg/anaconda3/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    459         }
    460         send_kwargs.update(settings)
--> 461         resp = self.send(prep, **send_kwargs)
    462 
    463         return resp

/home/belyaevadg/anaconda3/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
    597 
    598         # Resolve redirects if allowed.
--> 599         history = [resp for resp in gen] if allow_redirects else []
    600 
    601         # Shuffle things around if there's history.

/home/belyaevadg/anaconda3/lib/python3.6/site-packages/requests/sessions.py in <listcomp>(.0)
    597 
    598         # Resolve redirects if allowed.
--> 599         history = [resp for resp in gen] if allow_redirects else []
    600 
    601         # Shuffle things around if there's history.

/home/belyaevadg/anaconda3/lib/python3.6/site-packages/requests/sessions.py in resolve_redirects(self, resp, req, stream, timeout, verify, cert, proxies)
    190                 cert=cert,
    191                 proxies=proxies,
--> 192                 allow_redirects=False,
    193             )
    194 

/home/belyaevadg/anaconda3/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
    571 
    572         # Send the request
--> 573         r = adapter.send(request, **kwargs)
    574 
    575         # Total elapsed time of the request (approximately)

/home/belyaevadg/anaconda3/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    413 
    414         except (ProtocolError, socket.error) as err:
--> 415             raise ConnectionError(err, request=request)
    416 
    417         except MaxRetryError as e:

ConnectionError: ('Connection aborted.', TimeoutError(110, 'Connection timed out'))

Any help would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant