Spaces:
Runtime error
Runtime error
import os | |
import requests | |
def generate_access_token(): | |
url = "http://20.193.151.200:8080/token" | |
headers = { | |
"accept": "application/json", | |
"Content-Type": "application/x-www-form-urlencoded" | |
} | |
data = { | |
"grant_type": "", | |
"username": os.getenv("TOKEN_USERNAME"), | |
"password": os.getenv("TOKEN_PASSWORD"), | |
"scope": "", | |
"client_id": "", | |
"client_secret": "" | |
} | |
response = requests.post(url, headers=headers, data=data) | |
if(response.status_code != 200): | |
return None | |
return response.json()["access_token"] |