adsabs / adsabs-dev-api

Developer API service description and example client code
162 stars 58 forks source link

Example curl request in README does not produce X-RateLimit headers #72

Closed shortorian closed 3 years ago

shortorian commented 3 years ago

I'm using powershell on a windows 10 machine and I'm trying to figure out how to check my rate limits. Using the example in the README, I don't get any X-RateLimit response headers. For this input: curl.exe -v -H "Authorization: Bearer <token>" 'https://api.adsabs.harvard.edu/v1/search/query?q=star' I get this output:

*   Trying 34.197.154.114...
* TCP_NODELAY set
* Connected to api.adsabs.harvard.edu (34.197.154.114) port 443 (#0)
* schannel: SSL/TLS connection with api.adsabs.harvard.edu port 443 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 187 bytes...
* schannel: sent initial handshake data: sent 187 bytes
* schannel: SSL/TLS connection with api.adsabs.harvard.edu port 443 (step 2/3)
* schannel: failed to receive handshake, need more data
* schannel: SSL/TLS connection with api.adsabs.harvard.edu port 443 (step 2/3)
* schannel: encrypted data got 4096
* schannel: encrypted data buffer: offset 4096 length 4096
* schannel: encrypted data length: 4030
* schannel: encrypted data buffer: offset 4030 length 4096
* schannel: received incomplete message, need more data
* schannel: SSL/TLS connection with api.adsabs.harvard.edu port 443 (step 2/3)
* schannel: encrypted data got 1024
* schannel: encrypted data buffer: offset 5054 length 5054
* schannel: received incomplete message, need more data
* schannel: SSL/TLS connection with api.adsabs.harvard.edu port 443 (step 2/3)
* schannel: encrypted data got 477
* schannel: encrypted data buffer: offset 5531 length 6078
* schannel: sending next handshake data: sending 126 bytes...
* schannel: SSL/TLS connection with api.adsabs.harvard.edu port 443 (step 2/3)
* schannel: encrypted data got 274
* schannel: encrypted data buffer: offset 274 length 6078
* schannel: SSL/TLS handshake complete
* schannel: SSL/TLS connection with api.adsabs.harvard.edu port 443 (step 3/3)
* schannel: stored credential handle in session cache
> GET /v1/search/query?q=star HTTP/1.1
> Host: api.adsabs.harvard.edu
> User-Agent: curl/7.55.1
> Accept: */*
> Authorization: Bearer <token>
>
* schannel: client wants to read 102400 bytes
* schannel: encdata_buffer resized 103424
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: encrypted data got 1722
* schannel: encrypted data buffer: offset 1722 length 103424
* schannel: decrypted data length: 1693
* schannel: decrypted data added: 1693
* schannel: decrypted data cached: offset 1693 length 102400
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: decrypted data buffer: offset 1693 length 102400
* schannel: schannel_recv cleanup
* schannel: decrypted data returned 1693
* schannel: decrypted data buffer: offset 0 length 102400
< HTTP/1.1 200 OK
< Date: Thu, 07 Jan 2021 19:52:50 GMT
< Content-Type: application/json
< Content-Length: 419
< Connection: keep-alive
< Server: openresty/1.15.8.1
< Vary: Accept-Encoding
< Access-Control-Allow-Origin: http://0.0.0.0:8000, http://adsabs.harvard.edu, http://adsx.cfa.harvard.edu:8888, http://hourly.adslabs.org, http://localhost:8000, http://ui.adsabs.harvard.edu, http://ui.adslabs.org, https://arxiv.org, https://beta.arxiv.org, https://demo.adsabs.harvard.edu, https://dev.adsabs.harvard.edu, https://devui.adsabs.harvard.edu, https://experimental-bumblebee.us-east-1.elasticbeanstalk.com, https://prod.adsabs.harvard.edu, https://staging-bumblebee.elasticbeanstalk.com, https://staging-bumblebee.us-east-1.elasticbeanstalk.com, https://ui.adsabs.harvard.edu
< Access-Control-Allow-Methods: DELETE, GET, OPTIONS, POST, PUT
< Access-Control-Allow-Headers: Accept, Authorization, Content-Type, Orcid-Authorization, X-BB-Api-Client-Version, X-CSRFToken
< Access-Control-Allow-Credentials: true
< Vary: Origin
< Set-Cookie: session=.eJyrVopPK0otzlCyKikqTdVRis9MUbKqVlJIUrJSinKJLPcPiTT1c_fK8QvJyY0MyckG8it9q0Irolx8gXLJlZHhbjm-Ia62SrVAvQWpRbmJeal5JTDTSotTi8AmKhkZm5mZKtUCAA_bJIo.X_dmkg.W5Vy71TL5bBBk2MJbKRLyBk25_M; Expires=Sat, 08-Jan-2022 01:52:50 GMT; HttpOnly; Path=/
<
{"responseHeader":{"status":0,"QTime":189,"params":{"q":"star","fl":"id","start":"0","internal_logging_params":"X-Amzn-Trace-Id=Root=1-5ff76692-1340a6952264327a0c48d782","rows":"10","wt":"json"}},"response":{"numFound":538096,"start":0,"docs":[{"id":"7258815"},{"id":"12215563"},{"id":"7887328"},{"id":"7444840"},{"id":"11924081"},{"id":"482875"},{"id":"3843131"},{"id":"11219199"},{"id":"7259204"},{"id":"5098246"}]}}
* Connection #0 to host api.adsabs.harvard.edu left intact
marblestation commented 3 years ago

There was some recent change to our system that removed this information from the response header unintentionally, we are investigating. Thanks for reporting the problem!

shortorian commented 3 years ago

Just to confirm - the rate limits should just appear in the response headers, right? So if I look at the headers in a python response object from the requests package I should also see them?

marblestation commented 3 years ago

@shortorian You are correct! And the issue has been fixed, you should see these headers now. Thanks for reporting this problem!

shortorian commented 3 years ago

I see them now, thanks!