Skip to main content

HTTP communication through raw sockets using requests for RFC compliance testing

Project description

requests-raw

PyPI version Downloads PyPI - Python Version

Use requests to send HTTP raw sockets (To Test RFC Compliance)

Logo

Usage

Explicit

import json
import requests_raw

req = b"GET /get HTTP/1.1\r\nHost: httpbin.org\r\n\r\n"
res = requests_raw.raw(url='http://httpbin.org/', data=req)
res_json = res.json()
print(json.dumps(res_json, indent=2))

Implicit (monkey patch)

import json
import requests
import requests_raw
requests_raw.monkey_patch_all()

req = b"GET /cookies/set/name/value HTTP/1.1\r\nHost: httpbin.org\r\n\r\n"
session = requests.Session()
res = session.raw(url='https://httpbin.org/', data=req)
res_json = res.json()
print(json.dumps(res_json, indent=2))

Installation

Prerequisites

  • Python 3.7+
pip3 install requests-raw

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

requests-raw-2.0.2.tar.gz (10.0 kB view hashes)

Uploaded Source

Built Distribution

requests_raw-2.0.2-py2.py3-none-any.whl (11.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page