Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python requests-session for websites with login

# import requests module
import requests
 
# create a session object
s = requests.Session()
 
# set username and password
s.auth = ('user', 'pass')
 
# update headers
s.headers.update({'x-test': 'true'})
 
# both 'x-test' and 'x-test2' are sent
s.get('https://httpbin.org / headers', headers ={'x-test2': 'true'})
 
# print object
print(s)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #websites #login
ADD COMMENT
Topic
Name
9+5 =