Find file
Fetching contributors…
Cannot retrieve contributors at this time
60 lines (40 sloc) 1.7 KB


Python IMGUR API wrapper


  • pycurl
  • anonomous key from imgur

Usage example:

In [1]: from pyimgur import UploadImage as U

In [2]: a = U('roosevelt.jpg')

In [3]: a.imageURL.keys()
Out[4]: ['url', 'bigthumb', 'deletehash', 'hash', 'smallthumb']

In [4]: a.imageURL['url']
Out[4]: u''

In [5]: a.error
Out[5]: []

In [6]: b = U(dhash="1IRyqQVh9BokqEs", delete=True)

In [7]: b.message
Out[7]: ['Success!']

In [8]: b.error
Out[8]: []

Make sure to set anonymous imgur key.

Using the handler as a simple interface

alias grabs="scrot -s -e 'python \$f'"

Now just run grabs in your terminal, select your region, and watch the magic (browser opens uploaded image and you have the link in your clipboard).

Using the handler

The file is a quick example of integrating PyImgur with your system. To be able to right click on images and shoot them to Imgur with PyImgur, you can add a custom action by clicking Edit->Configure custom actions... and then follow the images below for a walk-through. After upload, the script will open the newly uploaded file on Imgur in your system web browser for you to view and share. You can also choose to show only on image files in the context portion of the second tab Appearance Conditions when configuring.

PyImgur Thunar Setup PyImgur Thunar Upload PyImgur Thunar Browser Success