flux
flux

Reputation: 93

instagram api keep raise 'You must provide a client_id' exception when I use python-instagram library

I registered my app in instagram developer dashboard and tried to use python-instagram library made by Facebook.

After I ran sample_app.py code, I accessed my test website(localhost:8515) and successfully logged in using my instagram id. However, I can't get access code because of this exception "You must provide a client_id"

I also tried the same thing using this library( https://github.com/Seraphicer/python-instagram-ext) This is because they pull requested original library and maintaining it.

Upvotes: 8

Views: 5536

Answers (2)

HetMes
HetMes

Reputation: 410

I've resorted to doing it myself; couldn't get python-instagram to work. Will probably ditch the entire library. Way too many bugs lately, and it's not being maintained, I think.

@classmethod
def exchange_code_for_access_token(cls, code, redirect_uri, **kwargs):
    url = u'https://api.instagram.com/oauth/access_token'
    data = {
        u'client_id': cls.get_client_id(),
        u'client_secret': cls.get_client_secret(),
        u'code': code,
        u'grant_type': u'authorization_code',
        u'redirect_uri': redirect_uri
    }

    response = requests.post(url, data=data)

    account_data = json.loads(response.content)

    return account_data

Upvotes: 9

Victor Gavro
Victor Gavro

Reputation: 1407

Had the same problem, obviously due instagram api or httplib2 update. Fixed for me https://github.com/vgavro/python-instagram/commit/9dfc264571ad7c343af3899445d13afedf23e3aa (link to my fork of python-instagram with patches needed for me)

Upvotes: 14

Related Questions