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

Auth throws value error on 504 #12

Open
bettsmatt opened this issue Jan 19, 2016 · 4 comments
Open

Auth throws value error on 504 #12

bettsmatt opened this issue Jan 19, 2016 · 4 comments

Comments

@bettsmatt
Copy link

I believe there is a bug in your auth code that raises a value error when encountering a 504 as content type if not set on the 504 response.

mendeley/auth.py in handle_text_response at line 12

def handle_text_response(rsp):
    if rsp.headers['content-type'] == 'text/plain':
        rsp._content = bytes(json.dumps({'error': 'invalid_client', 'error_description': rsp.text}), rsp.encoding)
        rsp.headers['content-type'] = 'application/json'
    return rsp

rsp.headers['content-type'] == 'text/plain': Raises a value error. Can you please fix this so the app using the API can choose how to handle the 504 response.

We are using version 0.3.2.

@bettsmatt
Copy link
Author

Are you going to fix this?

@Joyce-Stack
Copy link
Contributor

Joyce-Stack commented Apr 15, 2016

I'm happy for you to create a pull request and make a fix?

We have now added instructions for this on the README page including a build monitor.

Apologies for letting this slip.

@bettsmatt
Copy link
Author

Given this is the Mendeley API I would prefer if you fixed it. It is still an issue, this is our current work around.

 try:
     session = MendeleyAPIFinder.__start_mendeley_session()
 except KeyError as e:
     pass
 else:
     # Do stuff with the session.

@Joyce-Stack
Copy link
Contributor

Thank you for your contribution. We have recently added a Travis Build to the SDK and we do have tests so I encourage you to to create pull requests and ensure nobody else suffers ;-)

I do endeavour to try and fix these issues but I'm not always the best person as my Python is not very strong.

I'll take a look and run some tests locally. Thank you.

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

2 participants