Created
July 21, 2019 04:11
-
-
Save roycrxtw/de3b0f6570ef61fbd86f4d1e497bd205 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def uploadImage(): | |
with open("temp.jpg", "rb") as fs: | |
binary_data = fs.read() | |
url = 'https://api.imgur.com/3/image' | |
payload = {'image': binary_data} | |
files = {} | |
headers = { | |
'Authorization': 'Client-ID ' + client_id | |
} | |
response = requests.request('POST', url, headers = headers, data = payload, files = files, allow_redirects = False, timeout = 10000) | |
print(response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment