returns: object: data from the endpoint """ endpointParams = dict() endpointParams['metric'] = 'follower_count,impressions,profile_views,reach' endpointParams['period'] = 'day' endpointParams['access_token'] = params['access_token'] url = params['endpoint_base'] + \ params['instagram_account_id'] + '/insights' # endpoint url return makeApiCall(url, endpointParams, params['debug']) params = getCreds() params['debug'] = 'yes' response = getUserMedia(params) print("\n----- LATEST POST -----\n") print("\tLink to post:") print("\t" + response['json_data']['data'][0]['permalink']) print("\n\tPost Caption:") print("\t" + response['json_data']['data'][0]['caption']) print("\n\tMedia type:") print("\t" + response['json_data']['data'][0]['media_type']) print("\n\tPosted at") print("\t" + response['json_data']['data'][0]['timestamp']) params['latest_media_id'] = response['json_data']['data'][0]['id']
endpointParams['fields'] = 'id,name' # fields to get back endpointParams['access_token'] = params['access_token'] # access token url = params['endpoint_base'] + params['instagram_account_id'] + \ '/' + 'recently_searched_hashtags' # endpoint url # make the api call return makeApiCall(url, endpointParams, params['debug']) try: # try and get param from command line hashtag = sys.argv[7] # hashtag to get info on except: # default to coding hashtag hashtag = 'daylight' # hashtag to get info on params = getCreds() # params for api call params['debug'] = 'yes' params['hashtag_name'] = hashtag # add on the hashtag we want to search for hashtagInfoResponse = getHashtagInfo(params) # hit the api for some data! # store hashtag id params['hashtag_id'] = hashtagInfoResponse['json_data']['data'][0]['id'] # section heading print("\n\n\n\t\t\t >>>>>>>>>>>>>>>>>>>> HASHTAG INFO <<<<<<<<<<<<<<<<<<<<\n") print("\nHashtag: " + hashtag) # display hashtag print("Hashtag ID: " + params['hashtag_id']) # display hashtag id # section heading print( "\n\n\n\t\t\t >>>>>>>>>>>>>>>>>>>> HASHTAG TOP MEDIA <<<<<<<<<<<<<<<<<<<<\n" )