質問するログイン新規登録

質問編集履歴

1

def get_account_info を追記

2021/05/24 01:06

投稿

Yuta25jp
Yuta25jp

スコア13

title CHANGED
File without changes
body CHANGED
@@ -1,7 +1,7 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
3
  PythonのフレームワークDjangoを用いてウェブアプリを開発しています。
4
- そこで、json_dataとbusiness_discoveryを並べているソースコード6行目に関して該当のエラーがでました。
4
+ そこで、json_dataとbusiness_discoveryを並べている、def getの6行目に関して該当のエラーがでました。
5
5
  エラーで記述している、オーバーロードに関するリファレンスが少なく、苦戦しております。
6
6
 
7
7
  ### 発生している問題・エラーメッセージ
@@ -14,6 +14,22 @@
14
14
  ### 該当のソースコード
15
15
 
16
16
  ```Python
17
+
18
+
19
+ def get_account_info(params):
20
+ # エンドポイント
21
+ # https://graph.facebook.com/{graph-api-version}/{ig-user-id}?fields={fields}&access_token={access-token}
22
+
23
+ endpoint_params = {}
24
+ # ユーザ名、プロフィール画像、フォロワー数、フォロー数、投稿数、メディア情報取得
25
+ endpoint_params['fields'] = 'business_discovery.username(' + params['ig_username'] + '){\
26
+ username,profile_picture_url,follows_count,followers_count,media_count,\
27
+ media.limit(10){comments_count,like_count,caption,media_url,permalink,timestamp,media_type,\
28
+ children{media_url,media_type}}}'
29
+ endpoint_params['access_token'] = params['access_token']
30
+ url = params['endpoint_base'] + params['instagram_account_id']
31
+ return [call_api(url, endpoint_params)]
32
+
17
33
  def get(self, request, *args, **kwargs):
18
34
  # Instagram Graph API認証情報取得
19
35
  params = get_credentials()