M
M
MrFreeZZZ2017-11-01 12:16:23
Python
MrFreeZZZ, 2017-11-01 12:16:23

How to upload a file using Python?

There is an article on Habré "Giving files efficiently with PHP" ( https://habrahabr.ru/post/151795/)
Tell me how to send headers to the browser in Python 2.7, similar to php header()?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kzoper, 2017-11-01
@kzoper

import urllib2
req = urllib2.Request('http://www.example.com/')
req.add_header('Referer', 'http://www.python.org/')
resp = urllib2.urlopen(req)
content = resp.read()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question