PyImgur not Accessing Imgur through Rapid API

43 Views Asked by At

I am using the Pyimgur library to upload images to imgur. I can get it to work for non-commercial usage, but when I try to configure it for commercial usage, I get an error.

When I change the code from: im = pyimgur.Imgur(os.getenv("IMGUR_CONSUMER_ID")) to this: im = pyimgur.Imgur(os.getenv("IMGUR_CONSUMER_ID"),mashape_key=os.getenv("MASHAPE_KEY")) I get this error:

HTTPSConnectionPool(host='imgur-apiv3.p.mashape.com', port=443): Max retries exceeded with url: /3/image (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7cb9afb430>: Failed to establish a new connection: [Errno -2] Name or service not known'))

The issue is that imgur now uses RapidAPI instead of Mashape. The host should be imgur-apiv3.p.rapidapi.com instead of imgur-apiv3.p.mashape.com

I feel like if you just changed MASHAPE_BASE on line 51 of init.py (here: https://github.com/Damgaard/PyImgur/blob/master/pyimgur/__init__.py) to the correct url, it would work, but I don't know how to do that.

I installed the python library using pip.

I've tried posting the issue on github, but I don't think they maintain the repo anymore.

0

There are 0 best solutions below