File size: 635 Bytes
e3562c3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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"]