3
3

More than 5 years have passed since last update.

instagram api使うための、python-instagramモジュールで日本語検索ができなかった

Posted at

python-instagramモジュールで日本語検索ができなかった

  • 日本語でハッシュタグの写真検索するとエラーなる

英語は問題なく検索可能だ

tag_recent_media, next = api.tag_recent_media(tag_name='love')

日本語を検索かけるとエラーになる

tag_recent_media, next = api.tag_recent_media(tag_name='日本')

エラー内容

  File "/Users/free31/git/instag/src/instagram/bind.py", line 197, in _call
    return method.execute()
  File "/Users/free31/git/instag/src/instagram/bind.py", line 189, in execute
    content, next = self._do_api_request(url, method, body, headers)
  File "/Users/free31/git/instag/src/instagram/bind.py", line 137, in _do_api_request
    raise InstagramAPIError(content_obj.get('code'), content_obj.get('error_type'), content_obj.get('error_message'))
instagram.bind.InstagramAPIError: (403) OAuthForbiddenException-Invalid signed-request: Signature does not match

解決

  • モジュールファイルのbine.pyを修正して解決
value = quote(self.parameters[name])
↓↓↓↓↓
value = self.parameters[name].encode('utf8')
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3