#Load libraries
from dotenv import load_dotenv
import os
import pandas as pd
import requests
#Set up API
load_dotenv()
client_id = os.getenv('FATSECRET_CLIENT_ID')
client_secret = os.getenv('FATSECRET_CLIENT_SECRET')
proxy_ip = os.getenv('FATSECRET_IP')
proxies = {
'http': f'http://{proxy_ip}:808',
'https': f'http://{proxy_ip}:808'
}
grant_type = 'client_credentials'
scope = 'premier'
#Generate FatSecret Token
headers = {
'content-type': 'application/x-www-form-urlencoded'
}
data = {
'grant_type': grant_type,
'scope': scope
}
auth = requests.auth.HTTPBasicAuth(client_id,
client_secret)
auth=auth,
headers=headers,
data=data,
proxies=proxies)
print(token.json())
token_string = token.json()['access_token']