Skip to content

Instantly share code, notes, and snippets.

@m4rc1e
Created February 2, 2018 11:25
Show Gist options
  • Save m4rc1e/b16cf27b081ebf2e16f4988d4888f94e to your computer and use it in GitHub Desktop.
Save m4rc1e/b16cf27b081ebf2e16f4988d4888f94e to your computer and use it in GitHub Desktop.
Anonymously post an image to imgur v3 api
import requests
import json
img_path = 'foo/img_path.jpg'
r = requests.post('https://api.imgur.com/3/image',
data={'image': open(img_path, 'rb').read(), 'type': 'file' },
headers = {'Authorization': 'Client-ID {{Your-CLIENT-ID}}'}
)
print r.json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment