Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Requests Session in python

import requests
 
session = requests.Session()
 
url = 'https://httpbin.org/headers'
 
access_token = {
    'Authorization': 'Bearer {access_token}'
    }
 
session.headers.update(access_token)
 
response1 = session.get(url)
response2 = session.get(url)
 
print('response1: ', response1.json()['headers']['Authorization'])
print('response2: ', response2.json()['headers']['Authorization'])
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Requests #Session #python
ADD COMMENT
Topic
Name
6+5 =