abertschi / postcards

A CLI for the Swiss Postcard Creator :postbox:
https://abertschi.ch/blog/2022/receiving-postcards/
MIT License
36 stars 8 forks source link

403 while accessing pexels #32

Closed davidoesch closed 4 years ago

davidoesch commented 4 years ago

can't get anymore images from pexels ->403 see https://github.com/abertschi/postcards/commit/3cbb6f757c871a79d203ed0d6649e0dc508f7b63#commitcomment-36962319

proposal: replace get_random_image_url with https://pypexels.readthedocs.io/

abertschi commented 4 years ago

Thanks for reaching out!

I saw you commented some changes and suggested a proposal. Can you submit a pull request and take the lead in fixing this? I originally wanted to use the official API and requested a key but never implemented it. Never tried the key so perhaps get a new one if that one doesnt work anymore.

Just did a search on github and it seems that various projects include the API key in the source code. We can do the same as the key is not of much importance. Requesting a user to get their own api key is not convenient. You can include the following key in the pull request; perhaps use the base64 version and decode in code for some trivial obfuscation.

key (in base64):

NTYzNDkyYWQ2ZjkxNzAwMDAxMDAwMDAxNmEzNTcyNDA4YmVjNGFmNzc0YTYzYTRjNjdjZGNkMGIK

abertschi commented 4 years ago

Or even better, we already have basic obfuscation implemented for the config.json file. Use the decrypt function instead:

https://github.com/abertschi/postcards/blob/0e07f7d2fbe42a5141ab2421a592d56a225a950d/postcards/postcards.py#L307-L315