Imgur / imgurpython

Official Imgur python client library (deprecated)
MIT License
544 stars 116 forks source link

Allow permanent access to program #79

Closed KarelPeeters closed 7 years ago

KarelPeeters commented 7 years ago

Is there a way to allow a program to upload images on an account without requiring manual authorization from the user every time? The following code (heavily based on the example code) requires the user to allow access each time:

imgur = ImgurClient(IMGUR_CLIENT_ID, IMGUR_CLIENT_SECRET)
print(imgur.get_auth_url('pin'))
credentials = imgur.authorize(input("pin: "), 'pin')
imgur.set_user_auth(credentials['access_token'], credentials['refresh_token'])

Is there a way around this? I could login to a hidden browser instance using the plaintext login details, but that doesn't seem that secure to me...

KarelPeeters commented 7 years ago

I found a solution to my problem, this does indeed exist.

The Imgur API docs explain how it works, and the ImgurClient constructorin this module accepts the necessary parameters.