Last active
September 9, 2019 23:02
-
-
Save micheleberardi/7181cac001dc16ad960c2724ae6cfeec to your computer and use it in GitHub Desktop.
richiesta http
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
#!/usr/bin/env python3.4 | |
# -*- coding: utf-8 -*- | |
""" | |
Request Token long termn | |
""" | |
import requests | |
def get_token(access_token_url): | |
try: | |
response = requests.get(access_token_url) | |
if response.ok: | |
access_token = response.json() | |
user_long_token = access_token['access_token'] | |
return user_long_token | |
except: | |
return "error" | |
if __name__ == "__main__": | |
app_id = '512225539574368' | |
app_secret = '9dc19451ce6a58d4e22e9634053f443f' | |
user_short_token = 'EAAHR3c1UymABAARMW95G9U3NlzSE8lvWbmnJtGr7GauH3aofCCCiZBcxBfZBNN1ZAxOOWMEzzFgJLZAR2QHYtvIMZChB4ykU5U6ZAgvjdRo3lKffPeLJTPDztQZC29lN3mG4rVFFzuQibSVGhbr9Onhzf6oxfGXNbOSD9Sag5D3XjTgoH2LrfEfkUrj0SeZCXoNr9xaT7ZBrFoAZDZD' | |
access_token_url = "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={}&client_secret={}&fb_exchange_token={}".format( | |
app_id, app_secret, user_short_token) | |
token = get_token(access_token_url) | |
print(token) | |
""" | |
OUTPUT PARAGRAFO[3] | |
EAAHR3c1UymABAC84RLZAHWK8kZA9M8bKrgMUOZCJttwX4mk9kCTIc4afNyiJVPrhtHDrZCKPrb58ZCMT3v4SHnGKZCRRTOYOVFppk1iYEJYqSPZCWMAXtyvhkxpjZCKtBiqFa9ZA1jc5Vv5sAWEjiyvu43w7iWTZBcLIoZD | |
""" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment