Skip to content

Instantly share code, notes, and snippets.

Created April 16, 2020 16:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import json
import requests
server = ''
login_info = json.dumps({"email": 'YOUR-LOGIN',
"password": 'YOUR-PASSWORD'})
headers = {"Accept": "application/json",
"Content-Type": "application/json"}
def get_token(server, login_info):
url = server + "/auth/login"
#print("calling sherpa server '%s' ..." % url)
response =,data=login_info, headers=headers)
json_response = json.loads(response.text)
except Exception as ex:
print("Error connecting to Sherpa server %s: %s" % (server, ex))
#print("response = %s" % response.text)
if 'access_token' in json_response:
token = json_response['access_token']
return token
token = get_token(server,login_info)
print("token = %s" % token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment