1

I have been trying to use the Instagram API with python. After getting valid access_token, client_id, client_secret, I have tried to use the function user_recent_media.

access_token -

access_token, user_info = unauthenticated_api.exchange_code_for_access_token(code)

setting connection

api = client.InstagramAPI(access_token=access_token, client_secret=client_secret)

The connection is established successfully and then I wanted to get the user_recent media:

recent_media, next = api.user_recent_media(user_id = user_info['id'], count = 10)

Then I get the following error:

Traceback (most recent call last):
  File "C:/instagram/main.py", line 57, in <module>
    recent_media, next = api.user_recent_media(user_id = user_info['id'], count = 10)
  File "C:\Users\user-pc\Anaconda\lib\site-packages\instagram\bind.py", line 197, in _call
return method.execute()
  File "C:\Users\user-pc\Anaconda\lib\site-packages\instagram\bind.py", line 189, in execute
    content, next = self._do_api_request(url, method, body, headers)
  File "C:\Users\user-pc\Anaconda\lib\site-packages\instagram\bind.py", line 151, in _do_api_request
    obj = self.root_class.object_from_dictionary(entry)
  File "C:\Users\user-pc\Anaconda\lib\site-packages\instagram\models.py", line 99, in object_from_dictionary
    for comment in entry['comments']['data']:
KeyError: 'data'

Someone knows what is the problem? I have checked everywhere and couldn't find the reason for this error.

shahar
  • 31
  • 2
  • You might have to raise this issue with the package maintainers - it looks like the data they're receiving isn't what they expected. – jonrsharpe Jan 09 '16 at 09:51
  • Found out temporary solution, [link](http://stackoverflow.com/questions/33924581/keyerror-data-with-python-instagram-api-client) – shahar Oct 17 '16 at 00:05

0 Answers0