Instagram and oAuth

I am writing an application that will integrate with Instagram. In order for me to access some APIs, Instagram requires me to authenticate with oAuth. I have never used oAutho before and completely lost. In particular, I will do this in Python (not in my strong language), and thus, I don’t know where to start.

So, I know that before something I need to get the oAuth token. The Instagram site gave me client_secret and client_id. But it also gave me a redirect URI. I know that these three things should be used together, but I don’t know how to do it.

Since this is a desktop application, will I need to use some kind of web component?

Can someone point me in the right direction?

Thanks!

+4
source share
3 answers

You will probably need a module like https://github.com/Instagram/python-instagram ,

Example from the site

from instagram.client import InstagramAPI api = InstagramAPI(client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET') popular_media = api.media_popular(count=20) for media in popular_media: print media.images['standard_resolution'].url 
+4
source

I really recommend you play with an existing piece of code to help you understand how much python works with Instagram. Try using

https://github.com/oh-moore/followpie

or

https://github.com/marclave/InstaBot

Using any of them will help you understand how your oAuth works, and they already come with error messages, debugging, etc. You can just fill in the blanks and start hacking from there.

+2
source

There are some decent python oAuth libraries that make this pretty easy. Recommended on oAuth website python-oauth2 .

There are examples using Django and the twitter API - it's pretty easy to adapt for Instagram.

0
source

Source: https://habr.com/ru/post/1443145/


All Articles