This first part will focus on creating an anonymous API (Application programming interface) key for your script to use, and then upload an image to imgur.com. For this, and any following tutorals, I will be using Windows 7×64, with Python 2.7.
You will need to create an anonymous API key at http://imgur.com/register/api_anon, it’s really simple, just feed the name of your app, so the dudes over at Imgur know what your intentions are, and then your personal information and finally, the reCaptcha, to verify you’re not a bot. The next page will give you your developer API key; this is important. This key will allow you to interact with the Imgur API. Since this is the limited Anonymous API, you will only have access to basic functions, like uploading images from your computer or from another website, and getting gallery and image information. Luckily, that’s enough for our purposes here.
The documentation for the Imgur API that we’ll be using today is found here: http://api.imgur.com/resources_anon, and the requests module documentation is here http://docs.python-requests.org/en/latest/user/quickstart/. Now, open up your favourite text editor for coding. I like using Wing IDE Professional, but I’m sure notepad++ and any other one would work just as nicely. This is where the fun part begins. Hit the jump!
Tinypaste of the full working code!
Continue reading Imgur API part 1: getting an Anonymous Key and uploading an image