Skip to content
A simple command line client for uploading files to Imgur ⛺
Python
Branch: master
Clone or download
Pull request Compare This branch is 8 commits ahead, 1 commit behind atbaker:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Switching out hard-coded API keys for environment variables Apr 10, 2015
LICENSE
MANIFEST.in
README.rst
imgur_uploader.py
requirements.txt
setup.cfg
setup.py

README.rst

imgur-uploader

A simple command line client for uploading files to Imgur.

Created for my PyCon US 2015 Docker tutorial so that students using my cloud servers can see the gifs they create at the end of exercise 1.

This tool is open source under the MIT License.

Quickstart

Getting Imgur API credentials

Go to https://api.imgur.com/oauth2/addclient and register a new Imgur API client. You will need an Imgur account to do this.

You can put it any valid URL for the callback URL - we won't be using it.

Installing imgur-uploader

Installing imgur-uploader is easy. It runs on versions of Python >=2.7 or >=3.3.

If you just want to use imgur-uploader, you can just pip install imgur-uploader.

If you want to tweak or enhance imgur-uploader, follow these instructions:

  1. Clone this repository
  2. Install the tool with pip install -e .

Using imgur-uploader

First, create a file called ~/.config/imgur_uploader/uploader.cfg, with the following contents (substitute your credentials):

[imgur]
id = 9354da9ecdcfae3
secret = 8387eca75687ecad9876ead47786edac0875dc0d

Otherwise, set the IMGUR_API_ID and IMGUR_API_SECRET environment variables in your terminal session, using your client's credentials.

Upload an image by running imgur-uploader path/to/my.gif

The tool will return a shortened link to your uploaded gif upon completion:

Uploading file my.gif
...
File uploaded - see your gif at http://i.imgur.com/6WsQPpw.gif

If you want your images to appear in your account, you additionally need to get a refresh token. See the Imgur API <https://apidocs.imgur.com/#authorization-and-oauth> for information on how to obtain this. Then, add a refresh_token line in your config file:

[imgur]
id = 9354da9ecdcfae3
secret = 8387eca75687ecad9876ead47786edac0875dc0d
refresh_token = 9812398ab1b2cc98de9fa982bacd31cb312c6194
You can’t perform that action at this time.