Skip to content

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

License

Notifications You must be signed in to change notification settings

realgam3/requests-raw

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages