Skip to main content

A library for better processing of raw data

Project description

http-raw

A library for better processing of raw data✌️

Install

pip install http-raw

Use

import httpraw

raw = '''POST /post HTTP/1.1
Host: httpbin.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 19

key1=val1&key2=val2
'''

# resp is requests Response
resp = httpraw.request(raw=raw)
print(resp.status_code)
print(resp.text)

proxy = {
    'socks5': '127.0.0.1:1086'
}
resp = httpraw.request(raw=raw, proxy=proxy, timeout=5, ssl=True, verify=True)

# use api
url = 'http://httpbin.org/post'
headers = '''
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: close
Content-Type: application/x-www-form-urlencoded
'''
data = 'key1=val1&key2=val2'
resp = httpraw.post(url, headers=headers, data=data)

Dev

pipenv install --dev

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

http-raw-0.2.0.tar.gz (3.3 kB view hashes)

Uploaded source

Built Distribution

http_raw-0.2.0-py3-none-any.whl (15.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page