Open helpsocialbotspy opened 4 years ago
Solved it myself. I downgraded python from 3.7.0 to 3.6.0 to resolve the issue. Please update the documentation to clearly call out which python versions are supported. Keeping the issue open till the documentation is updated.
Hi, thanks for reporting this.
The support matrix includes Py2.7x, and Py3.5, Py3.6, Py3.7, and Py3.8: they are tested in all regressions.
I can't reproduce that error with that code on Python 3.7: it doesn't look like something related to that particular Python version, unless you have an uncommon Json library, which I doubt.
Can you reproduce consistently? If you can, could you run this code:
import logging
from pyunsplash import PyUnsplash
# Initialize app logging
logger = logging.getLogger()
logging.basicConfig(filename='app.log', level=logging.DEBUG)
api_key = '<YOUR_API_KEY>'
pu = PyUnsplash(api_key=api_key)
logging.getLogger("pyunsplash").setLevel(logging.DEBUG)
search = pu.search(type_='photos', query='red,car')
for photo in search.entries:
print(photo.id, photo.link_download)`
and upload the app.log
logfile? I'd like to take a look.
Cheers,
After further investigation, I cannot reproduce, and the issue seems more related to an invalid body. I am going to close this now. Feel free to reopen if you can provide the requested logs.
app.log i have the same error
@PureDreamer Thank you for reporting this, and including the logs. The issues is that your program has exceeded the [https://unsplash.com/documentation#rate-limiting](Unsplash Rate Limiting) threshold. For that reason, the library received an error 403.
Unfortunately, Unsplash API also returns a body which is not JSON, hence when PyUnplash tries to decode it as json, an exception is raised.
The only improvement I will add here is a custom exception with a better description for specific error cases (like this one, and more in the future if we discover new).
However, from your point of view, you should implement the following:
Let me know if you have questions.