Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Python IMGUR API wrapper

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 handler.py
Octocat-spinner-32 local_settings.py.dist
Octocat-spinner-32 pyimgur.py
README.md

PyImgur

Python IMGUR API wrapper

Requirements:

  • 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'http://i.imgur.com/cUWzn.jpg'

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 handler.py as a simple interface

alias grabs="scrot -s -e 'python handler.py \$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 handler.py 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 SetupPyImgur Thunar UploadPyImgur Thunar Browser Success

Something went wrong with that request. Please try again.