Last active
October 6, 2021 13:14
-
-
Save RizqiEka/4538827e76d349022aa742569a204f26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
media_insight = [] | |
# Loop Over 'Media ID' | |
for i in basic_insight['data']: | |
params['latest_media_id'] = i['id'] | |
# Define URL | |
url = params['endpoint_base'] + params['latest_media_id'] + '/insights' | |
# Define Endpoint Parameters | |
endpointParams = dict() | |
endpointParams['metric'] = 'engagement,impressions,reach,saved' | |
endpointParams['access_token'] = params['access_token'] | |
# Requests Data | |
data = requests.get(url, endpointParams ) | |
json_data_temp = json.loads(data.content) | |
media_insight.append(list(json_data_temp['data'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment