An easy to use HTTP client
Project description
urlfetch is a simple, lightweight and easy to use HTTP client for Python. It is distributed as a single file module and has no depencencies other than the Python Standard Library.
Highlights
Distributed as a single file module, has no depencencies other than the Python Standard Library.
Pure Python, works fine with gevent.
Small codebase, about 1000 lines and 30% are comments and blank lines. Only 10 minutes you can known every detail.
Random user-agent.
Support streaming.
Installation
$ pip install urlfetch
Hello World
from urlfetch import get response = get('http://python.org/') print response.content
Upload file
from urlfetch import post response = post( 'http://127.0.0.1:8888/upload', headers = { 'Referer': 'http://127.0.0.1/', }, files = { 'fieldname1': open('/path/to/file', 'rb'), #'fieldname2': 'file content', # file must have a filename 'fieldname3': ('filename', open('/path/to/file2', 'rb')), 'fieldname4': ('filename', 'file content'), }, data = { 'foo': 'bar' }, ) print response.status, response.content
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
urlfetch-1.0.zip
(28.4 kB
view hashes)
urlfetch-1.0.tar.gz
(25.1 kB
view hashes)
urlfetch-1.0.tar.bz2
(22.3 kB
view hashes)