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 :: iqr in python 
Python :: remove blank spaces from a list python 
Python :: nan float python 
Python :: solve system of linear equations numpy 
Python :: plt.savefig 
Python :: round python 
Python :: play music with time in python 
Python :: drop column dataframe 
Python :: median absolute deviation scipy 
Python :: how to invert a list in python 
Python :: pandas summarize all columns 
Python :: pandas inner join on two columns 
Python :: how to format integer to two digit in python 
Python :: Get all the categorical column from the dataframe using python 
Python :: select rows which entries equals one of the values pandas 
Python :: how to convert string to byte without encoding python 
Python :: how to use python to sleep if the user is not using the system 
Python :: python datetime difference in seconds 
Python :: pyspark case when 
Python :: convert video to text python 
Python :: python add 0 before number 
Python :: python testing machine learning 
Python :: how to get all folders on path in python 
Python :: python catch sigterm 
Python :: how to count range in django template 
Python :: check if back is pressed python 
Python :: convert from 12 hrs to 24 python 
Python :: python get current time 
Python :: python read html table 
Python :: extract column numpy array python 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =