I am trying to access a AMBIMA API but, according to how to page, I need a token from authentication API. I have followed the authentication page instructions and got a response but where should have a token comes the message “method not allowed”.
how to page: https://developers.anbima.com.br/pt/documentacao/visao-geral/como-acessar-nossas-apis/
authentication page: https://developers.anbima.com.br/pt/documentacao/visao-geral/autenticacao/#oauth2
The code I used:
url = "https://api.anbima.com.br/oauth/access-token"
header = {
"Content-Type": "application/json",
"Authorization": "Basic base64(my_id:my_access)",
}
response = requests.get(url, header)
infos = response.json()
the result:
{'timestamp': 1714681762294, 'status': 405, 'error': 'Method Not Allowed'}
I have tried to change requests.get()
to requests.post()
and add the line "grant_type": "client_credentials"
to the dictionary but both returns different errors. What could I do?