Pythonic way of HTTP request
Project description
##PyHTTP
Very Minimal HTTP wrapper for Python.
[![Build Status](https://travis-ci.org/plasmashadow/pyhttp.svg?branch=master)](https://travis-ci.org/plasmashadow/pyhttp)
[![PyPI version](https://badge.fury.io/py/pyrequest.svg)](http://badge.fury.io/py/pyrequest)
[![PyPI](https://img.shields.io/pypi/dm/pyrequest.svg)](https://pypi.python.org/pypi/pyrequest)
[![Code Health](https://landscape.io/github/plasmashadow/pyhttp/master/landscape.svg?style=flat)](https://landscape.io/github/plasmashadow/pyhttp/master)
##installation
```
pip install pyrequest
```
##Usage
```python
from pyhttp import Request
r = Request("google.com").get()
print r.status
//POST request
r = Request('http://jsonplaceholder.typicode.com/posts')
response = r.post({'title': 'hello'})
print response.content
print response.status
print response.json
//setting headers
r = Request('http://jsonplaceholder.typicode.com/posts')
r.headers = {'content-type': 'application/json')
response = r.post({'title': 'hello'})
print response.content
print response.status
print response.json
//PUT request
r = Request('http://jsonplaceholder.typicode.com/posts/1')
response = r.put({'title': 'hello'})
print response.content
print response.status
print response.json
//DELETE request
r = Request('http://jsonplaceholder.typicode.com/posts/1')
r.delete()
```
##License
MIT
Very Minimal HTTP wrapper for Python.
[![Build Status](https://travis-ci.org/plasmashadow/pyhttp.svg?branch=master)](https://travis-ci.org/plasmashadow/pyhttp)
[![PyPI version](https://badge.fury.io/py/pyrequest.svg)](http://badge.fury.io/py/pyrequest)
[![PyPI](https://img.shields.io/pypi/dm/pyrequest.svg)](https://pypi.python.org/pypi/pyrequest)
[![Code Health](https://landscape.io/github/plasmashadow/pyhttp/master/landscape.svg?style=flat)](https://landscape.io/github/plasmashadow/pyhttp/master)
##installation
```
pip install pyrequest
```
##Usage
```python
from pyhttp import Request
r = Request("google.com").get()
print r.status
//POST request
r = Request('http://jsonplaceholder.typicode.com/posts')
response = r.post({'title': 'hello'})
print response.content
print response.status
print response.json
//setting headers
r = Request('http://jsonplaceholder.typicode.com/posts')
r.headers = {'content-type': 'application/json')
response = r.post({'title': 'hello'})
print response.content
print response.status
print response.json
//PUT request
r = Request('http://jsonplaceholder.typicode.com/posts/1')
response = r.put({'title': 'hello'})
print response.content
print response.status
print response.json
//DELETE request
r = Request('http://jsonplaceholder.typicode.com/posts/1')
r.delete()
```
##License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyrequest-0.5.tar.gz
(2.7 kB
view details)
File details
Details for the file pyrequest-0.5.tar.gz
.
File metadata
- Download URL: pyrequest-0.5.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a818e92fa6f85f8b81966f083091a947438916ecc2e37dc2acff19db49699117 |
|
MD5 | 221b5f0b96e58862e0144035cf9f14f5 |
|
BLAKE2b-256 | 6f945d2dabd104000530fddc8de92cf731a9706642d3879e28c09c27ae2b8758 |