Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

add headers tp requests python

url = 'https://api.github.com/some/endpoint'
payload = {'some': 'data'}
headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
                    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                    'Referer': 'https://cssspritegenerator.com',
                    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                    'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
                    'Accept-Encoding': 'none',
                    'Accept-Language': 'en-US,en;q=0.8',
                    'Connection': 'keep-alive'
                    }

r = requests.get('<api-endpoint>', headers=headers)
Comment

python request add header

headers_dict = {"Cookie": "cookie1=value1"}
Comment

PREVIOUS NEXT
Code Example
Python :: pandas dataframe caption 
Python :: list out the groups from groupby 
Python :: phyton 2.7 convert timedelta to string 
Python :: how to add value in array django 
Python :: plot path in pillow python 
Python :: x y coordinates in python 
Python :: AI chatbot in Python - NAYCode.com 
Python :: tuple count in python 
Python :: how to sort the order in multiple index pandas 
Python :: reshape (n ) to (n 1) 
Python :: frozen 
Python :: python glob.glob recursive 
Python :: SUMOFPROD1 Solution 
Python :: python 2 print in same line 
Python :: python generate dictionary in loop 
Python :: get request in django 
Python :: linkedin api with python 
Python :: python how to check if a dictionary key exists 
Python :: python breadth first search 
Python :: multiple channel deleteing command in discord.py 
Python :: python dataframe appendisnt showing 
Python :: adding two strings together in python 
Python :: instance method in python 
Python :: how to repeat code in python until a condition is met 
Python :: To Divide or Not To Divide codechef solution 
Python :: python list object attributes 
Python :: python read from stdin pipe 
Python :: python close a socket 
Python :: python import matplotlib 
Python :: pd.merge duplicate columns remove 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =