简体   繁体   中英

Instagram API fails on follow_user(user_id)

I have auth'ed with Instagram API and can retrieve media objects with no problem. The function 'follow_user(user_id) returns this:

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/instagram/bind.py", line 84, in _build_path
raise Exception('No parameter value found for path variable: %s' % name)
Exception: No parameter value found for path variable: user_id

I've tried using a string, integer, and the media.user.id property as a parameter for this function but the same error each time.

My workaround is to use a manual HTTP POST request to the API using the Requests module:

   payload = { "ACCESS_TOKEN" : "Your_Instagram_Access_Token_Here",
              "action" : "follow"}
   r = requests.post(r'https://api.instagram.com/v1/users/'+ user_id +'/relationship?access_token=Your_Instagram_API_Token_HERe',data=payload)
   print r.text

Old question - but the correct call is...

api.follow_user(user_id=the_user_id) 

...where 'the_user_id' is the ID number you're trying to follow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM