Exemplo SUAP
import requests
from getpass import getpass
api_url = "https://suap.ifrn.edu.br/api/"
user = input("user: ")
password = getpass()
data = {"username":user,"password":password}
response = requests.post(api_url+"v2/autenticacao/token/", json=data)
token = response.json()["access"]
print(response.json())
headers = {
"Authorization": f'Bearer {token}'
}
print(headers)
response = requests.get(api_url+"v2/minhas-informacoes/meus-dados/", headers=headers)
print(response.text)
print(response)