Closed hbagdi closed 7 years ago
Also, the unsplash API itself is erroneous. It returns 10mil range numbers sometimes. Dev said it's a known issue. Follow this up once they solve it.
The new production rate limit is very high and I couldn't exhaust it easily. Try next time with a new low limit test app.
$ curl "https://api.unsplash.com/photos/client_id=CLIENT-ID" -v
* Trying 151.101.49.181...
* Connected to api.unsplash.com (151.101.49.181) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 697 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
* server certificate verification OK
* server certificate status verification SKIPPED
* common name: p.ssl.fastly.net (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: C=US,ST=California,L=San Francisco,O=Fastly\, Inc.,CN=p.ssl.fastly.net
* start date: Fri, 12 May 2017 21:29:08 GMT
* expire date: Fri, 28 Dec 2018 14:41:49 GMT
* issuer: C=BE,O=GlobalSign nv-sa,CN=GlobalSign CloudSSL CA - SHA256 - G3
* compression: NULL
* ALPN, server accepted to use http/1.1
> GET /photos/?client_id=<CLIENT-ID> HTTP/1.1
> Host: api.unsplash.com
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 403 Forbidden
< Server: Cowboy
< X-Ratelimit-Limit: 50
< X-Ratelimit-Remaining: 0
< X-Request-Id: ec39508a-a44c-42e2-8e0a-e390b6720017
< X-Runtime: 0.002210
< Strict-Transport-Security: max-age=31536000
< Via: 1.1 vegur
< Via: 1.1 varnish
< Fastly-Debug-Digest: 93fcc05b5063a66a64a87c6b4175c11e92db67af278b772474871fad52ea58c9
< Content-Length: 19
< Accept-Ranges: bytes
< Date: Fri, 28 Jul 2017 02:48:43 GMT
< Via: 1.1 varnish
< Connection: keep-alive
< X-Served-By: cache-iad2128-IAD, cache-dfw1836-DFW
< X-Cache: MISS, MISS
< X-Cache-Hits: 0, 0
< X-Timer: S1501210123.985107,VS0,VE40
< Vary: Origin
<
* Connection #0 to host api.unsplash.com left intact
Rate Limit Exceeded
403 + 0 remaining means rate limiting error?
The current code is returning AuthError even for a rate limiting case. unsplash's API doesn't give a resume time header but since they do it per hour, upon hitting the rate limit, just don't send the request till the next hour begins. Needs much more though.