Dimitris Kougioumtzis Blog About technology

Python3 requests with authentication

Category Python

Posted on Oct. 17, 2018



Python3 requests with authentication


1
2
3
4
5
6
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)

About

My name is Dimitris Kougioumtzis and i work as a Web developer at Rapidbounce Company

Elsewhere