Skip to content

urlfetch is a simple, lightweigth 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.

License

Notifications You must be signed in to change notification settings

SmartOwen/urlfetch

 
 

Repository files navigation

urlfetch

https://travis-ci.org/ifduyue/urlfetch.png https://coveralls.io/repos/ifduyue/urlfetch/badge.png?branch=master https://badge.fury.io/py/urlfetch.png https://pypip.in/d/urlfetch/badge.png

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.

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
Bitdeli badge

About

urlfetch is a simple, lightweigth 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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published