import requests

from requests . auth import HTTPBasicAuth

headers = { 'accept' : 'application/json;odata=verbose' }

r = requests . get ( "http://example/_api/web" , auth = HTTPBasicAuth ( 'someUser' , 'somePassword' ) , headers = headers )