2017-04-06 5 views
0

だから私は、特定のパラメータに合わせInstagramの写真を取得しようとしていると私は、次のスタック取得しています:のpython-InstagramのOAuthPermissionsException

Traceback (most recent call last): 
    File "instagram_find_shows.py", line 83, in <module> 
    if __name__ == "__main__": main() 
    File "instagram_find_shows.py", line 48, in main 
    get_instagram_posts(show_name, show_time, coordinates) 
    File "instagram_find_shows.py", line 73, in get_instagram_posts 
    str(coordinates[1]), min_time, max_time) 
    File "C:\Users\User Name\Anaconda3\lib\site-packages\instagram\bind.py", line 197, in _call 
    return method.execute() 
    File "C:\Users\User Name\Anaconda3\lib\site-packages\instagram\bind.py", line 189, in execute 
    content, next = self._do_api_request(url, method, body, headers) 
    File "C:\Users\User Name\Anaconda3\lib\site-packages\instagram\bind.py", line 163, in _do_api_request 
    raise InstagramAPIError(status_code, content_obj['meta']['error_type'], content_obj['meta']['error_message']) 
instagram.bind.InstagramAPIError: (400) OAuthPermissionsException-This request requires scope=public_content, but this access token is not authorized with this scope. The user must re-authorize your application with scope=public_content to be granted this permissions. 

コードは次のとおりです。

def get_instagram_posts(name, time, coordinates): 
    max_time_dt = time + timedelta(hours=3) 
    min_time_dt = time - timedelta(hours=1) 

    max_time = str(calendar.timegm(max_time_dt.timetuple())) 
    min_time = str(calendar.timegm(min_time_dt.timetuple())) 

    dist_rad_str = str(insta_dist_radius_m) 
    count_str = str(insta_count) 

    api = InstagramAPI(access_token=insta_access_token, 
     client_secret=insta_client_secret) 

    r = api.media_search(name, count_str, str(coordinates[0]), 
     str(coordinates[1]), min_time, max_time) 

    photos = [] 

    for media in r: 
     photos.append('<img src="%s"/>' % media.images['thumbnail'].url) 

    print(photos[0]) 

Iを文字通り私は簡単なテストをしようとしているだけで、APIを壊すことはしません。 Instagramのパラメータ内でこれを行う方法はありますか?本当にありがとう!

答えて

0

ブラウザで次のURLに移動して修正:

https://www.instagram.com/oauth/authorize?client_id=[CLIENT_ID]&redirect_uri=[REDIRECT_URI]&response_type=code&scope=basic+public_content+follower_list+comments+relationships+likes

関連する問題