You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

14 line
424 B

  1. import json
  2. import requests
  3. class Authorization:
  4. def get_token(self, login_data, DEBUG=False):
  5. if DEBUG: print("- - Sono entrato in get_token")
  6. api_url = '{0}/token'.format(self.api_url_base)
  7. response = requests.post(api_url, auth=(login_data['username'],login_data['password']) )
  8. if response.status_code == 200:
  9. return response.json()
  10. else:
  11. return None