Python3 requests with authentication

Python -- Posted on Oct. 17, 2018

Python3 requests with authentication

              
                def get_data(auth_user, auth_passwd, url):
    headers = {'Accept': 'application/json'}
    response = requests.get(
        url, auth=requests.auth.HTTPBasicAuth(
            auth_user, auth_passwd), headers=headers)
    return json.loads(response.text)
                  
   
            

Related Posts