You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

requests-raw

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requests-raw

HTTP communication through raw sockets using requests for RFC compliance testing

2.0.2
Source
pipPyPI
Maintainers
1

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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts