Hello,
I am trying to translate this Python3 script into Julia (https://github.com/Brightspace/bds-headless-client-example/blob/master/main.py) to gain more familiarity with Julia and building an application that relies on an API.
In particular, I am trying to understand the following function:
def trade_in_refresh_token(config):
# https://tools.ietf.org/html/rfc6749#section-6
response = requests.post(
'{}/core/connect/token'.format(config['auth_service']),
# Content-Type 'application/x-www-form-urlencoded'
data={
'grant_type': 'refresh_token',
'refresh_token': config['refresh_token'],
'scope': 'datahub:dataexports:*'
},
auth=HTTPBasicAuth(config['client_id'], config['client_secret'])
)
if response.status_code != 200:
logger.error('Status code: %s; content: %s', response.status_code, response.text)
response.raise_for_status()
return response.json()
Does the HTTP (or any Julia) package have the ability to specify a Dictionary for the grant_type
, refresh_token
, and scope
and has a similiar function to HTTPBasicAuth to parse in the client_id
and client_secret
?
I have executed the Python3 script without complications, but I have a limited understanding on HTTP post and response functions.
Is there any good documentation about how to make Julia work for the scenario?
Thanks!