Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danhper/python2-http-wrapper

Basic easy to use HTTP wrapper around urllib for Python2
https://github.com/danhper/python2-http-wrapper

Last synced: about 2 months ago
JSON representation

Basic easy to use HTTP wrapper around urllib for Python2

Awesome Lists containing this project

README

        

# http-wrapper

A very basic HTTP wrapper library around urllib for Python2.

It only has a very limited set of feature compared to httplib but allows to deal easily with pages with 'exotic' encodings.

## Sample usage

#-*- coding: utf-8 -*-

import http

request = http.HTTPRequest("http://dummy.site.com", method="POST", encoding="sjis")
request.set_parameter('foo', 'bar')
request.set_parameter('exotic_encoding', u'utf使おう><') # will encoded in sjis
response = request.send() # necessary headers will be added
print response.code
body = response.get_body() # gets the body decoded from sjis and gunzipped if needed
print body