python-instagram
python-instagram copied to clipboard
Fix error when Instagram return lowercase "content-location"
Catch a strange error - instagram return in headers lowercased "content-location".
There is the error in design because of the response of request module already lowercase headers. And enough to make one check ('content-location' in response).
Why not response.get('content-location', response['Content-Location'])
?
Anyway - the Instagram v1 API this library uses, has been deprecated and will be discontinued. A lot of instagram endpoints are already no longer available: https://www.instagram.com/developer/changelog/
Because response['Content-Location'] rise KeyError exception. But it's still working, and why not to fix some errors - and publish it on PyPI warehouse?
The point is that it should not fail silently; either 'Content-Location'
or 'content-location'
should be tried.
If neither of these headers are there, raising an exception is correct. Might be nicer to raise a OAuth2AuthExchangeError
ofc