-
Notifications
You must be signed in to change notification settings - Fork 58
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
401 Unauthorized #32
Comments
Hi Boris,
It's a problem of our documentation, sorry about that. First, the 'q'
parameter shouldn't be empty, it needs to contain a valid query - you can
use '*:*' - and finally, there is an extra space in the Authorization
header. Please see below for an example:
In [7]: r = requests.post('https://api.adsabs.harvard.edu/v1/search/bigquery
',
...: params={'q':'*:*', 'wt':'json', 'fq':'{!bitset}', 'fl':'bibcode'},
...: headers={'Authorization': 'Bearer:' + token},
...: data=bibcodes)
In [8]: r.status_code
Out[8]: 200
In [9]: r = requests.post('https://api.adsabs.harvard.edu/v1/search/bigquery
',
...: params={'q':'*:*', 'wt':'json', 'fq':'{!bitset}', 'fl':'bibcode'},
...: headers={'Authorization': 'Bearer: ' + token},
...: data=bibcodes)
In [10]: r.status_code
Out[10]: 401
I'll fix the documentation.
Thanks!
Roman
…On Tue, Jun 13, 2017 at 3:29 PM, Boris Revechkis ***@***.***> wrote:
Using the example Python snippet:
bibcodes="bibcode\n1907AN....174...59.\n1908PA.....16..445.
\n1989LNP...334..242S"
r = requests.post('https://api.adsabs.harvard.edu/v1/search/bigquery',
params={'q':'*:*', 'wt':'json', 'fq':'{!bitset}', 'fl':'bibcode'},
headers={'Authorization': 'Bearer: mytokenhere'},
data=bibcodes)
I get a 401 unathorized response. I can do a curl request with the same
token, and it works fine.
Thanks for all the great work and in advance for any help.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#32>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHURkZbyqcXtBusdvAFpG9buUmEOsSSjks5sDuMKgaJpZM4N497I>
.
|
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the example Python snippet:
I get a 401 unathorized response. I can do a curl request with the same token, and it works fine.
Thanks for all the great work and in advance for any help.
The text was updated successfully, but these errors were encountered: