-
Notifications
You must be signed in to change notification settings - Fork 59
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
curl working but not request #103
Comments
Hello, Thank you for reaching out to ADS. Looking at the code you provided, I think the issue may be a subtle difference in formatting in this line here: headers={'Authorization': 'Bearer:TOKEN'}, The authentication methods are very sensitive to syntax, so this line should really be headers={'Authorization': 'Bearer TOKEN'}, like it is in the -H 'Authorization: Bearer TOKEN' I hope this helps, -Taylor |
Hello, I'm coming back to this to clarify that changing Bearer:TOKEN to Bearer TOKEN did not work... Are there any other ideas of what might be going on? Thanks again! |
Hello, I took the python code you provided and ran it against import requests
TOKEN=REPLACE_TOKEN
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 '+str(TOKEN)},
data=bibcodes)
print(r.text) For more detailed troubleshooting if this doesn't solve the issue, can you send an email with a detailed description of your current issue, as well as the goal of your queries, to adshelp[at]cfa.harvard.edu? Thanks, Taylor |
Hello,
Thanks so much for this service. I would love to take advantage of it, but I'm running into an authorization issue, it seems.
I would expect the following code to work:
However, the result is:
However, the equivalent request via curl:
works and returns:
requests is v2.31.0 and Python is v3.8.6.
Thanks in advance for the help!
The text was updated successfully, but these errors were encountered: