Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

urllib.request headers

try:
    from urllib.request import Request, urlopen  # Python 3
except ImportError:
    from urllib2 import Request, urlopen  # Python 2

req = Request('http://api.company.com/items/details?country=US&language=en')
req.add_header('apikey', 'xxx')
content = urlopen(req).read()

print(content)
Comment

PREVIOUS NEXT
Code Example
Python :: countplot in pandas 
Python :: linkedin dynamic scrolling using selenium python 
Python :: python moving average time series 
Python :: python ignore exception 
Python :: import statsmodels.api as sm 
Python :: selenium python 
Python :: language detection python 
Python :: python install bigquery 
Python :: Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied. 
Python :: how to make a infinite loop in python 
Python :: python print int in string with zero padding 
Python :: get requests from python 
Python :: RuntimeWarning: invalid value encountered in true_divide 
Python :: sort tuple list python 
Python :: python list of all tkinter events 
Python :: python json load file 
Python :: Tkinter canvas draggable 
Python :: how to change kay bindings in pycharm 
Python :: delete unnamed coloumns in pandas 
Python :: how to sort dictionary in python by value 
Python :: python cv2.Canny() 
Python :: find index of pandas column 
Python :: remove emoji from dataframe 
Python :: find first date python 
Python :: How to set font size of Entry in Tkinter 
Python :: how to click on button using python 
Python :: python append element to array 
Python :: python extract value from a list of dictionaries 
Python :: sort list in python by substring 
Python :: using while loop in python taking input until it matches the desired answer 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =