Python wrapper for Chromium's http library
Project description
python-cronet
python-cronet is a library to use Chromium's network stack from Python.
The library is currently in alpha stage.
What is Cronet
Cronet is the networking stack of Chromium put into a library for use on Android. It offers an easy-to-use, high performance, standards-compliant, and secure way to perform HTTP requests.
The Chromium team also provides a native version of the library(not officially supported) which allows you to use it in desktop/server operating systems like Linux, macOS and Windows.
The main benefits of using cronet as an HTTP client are:
- You get to use the same high quality code that runs on Chromium.
- Support for the latest protocols like QUIC and compression formats.
- Concurrency support by performing asynchronous requests.
- Has the same TLS fingerprint as Chrome, meaning that Cloudflare and other bot detection systems can't block your requests based on it.
- It's much more lightweight on system resources compared to headless Chrome(although it doesn't support executing javascript).
Installation
For the time being the only supported platform is linux-x86-64. The plan is to also support windows and macOS.
pip install python-cronet
Example usage
The library provides an asynchronous API:
import asyncio
import cronet
async def main():
with cronet.Cronet() as cr:
# GET request
response = await cr.get("https://httpbin.org/get")
print(f"GET request: {response.url}, {response.status_code}")
print(f"Response JSON: {response.json()}")
# GET request with query parameters
params = {"param1": "value1", "param2": "value2"}
response = await cr.get("https://httpbin.org/get", params=params)
print(f"GET request with params: {response.url}, {response.status_code}")
print(f"Response JSON: {response.json()}")
# POST request with form data
data = {"key1": "value1", "key2": "value2"}
response = await cr.post("https://httpbin.org/post", data=data)
print(f"POST request: {response.url}, {response.status_code}")
print(f"Response JSON: {response.json()}")
# PUT request with JSON data
json_data = {"key1": "value1", "key2": "value2"}
response = await cr.put("https://httpbin.org/put", json=json_data)
print(f"PUT request: {response.url}, {response.status_code}")
print(f"Response JSON: {response.json()}")
# PATCH request with custom headers
headers = {"X-Custom-Header": "MyValue"}
response = await cr.patch("https://httpbin.org/patch", headers=headers)
print(f"PATCH request: {response.url}, {response.status_code}")
print(f"Response JSON: {response.json()}")
# DELETE request
response = await cr.delete("https://httpbin.org/delete")
print(f"DELETE request: {response.url}, {response.status_code}")
print(f"Response JSON: {response.json()}")
asyncio.run(main())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_cronet-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: python_cronet-0.1.6-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e60b5ef9be2a11fa5fe525d1b11e42930031354ed2c4ee69ec9687741a33a0a
|
|
| MD5 |
a1f7d8d12dcba8d6d0c244e409b2a36b
|
|
| BLAKE2b-256 |
9a4d010d210c0520d9c86fe66cf8de50295d81d2c8705400e8a965e03049fa87
|
File details
Details for the file python_cronet-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: python_cronet-0.1.6-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5d26c0ab67b99c8bcf9d8fc0de4bf9f8b861e997fa5b1e707ba3f8579ba1783
|
|
| MD5 |
1ab5b85939568d0abde8f59ab8242153
|
|
| BLAKE2b-256 |
8f98570ebdfb0d8fb0c15ff34b4b7d66e7ec30bf7c720e88d0a3cefa0dea4748
|
File details
Details for the file python_cronet-0.1.6-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: python_cronet-0.1.6-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dbfb0e0b58914d1ec06a50a9bf66f0aed9a90878da1483f3d86dfe274a3c8ee
|
|
| MD5 |
d7e5cadb591f237a646c38164062d515
|
|
| BLAKE2b-256 |
ec5ff628a46ad312b18476b3b69194fc1893300c3904e2d8255c9be828233084
|
File details
Details for the file python_cronet-0.1.6-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: python_cronet-0.1.6-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4af2c8af88320c89222c2010c8a801c363a6e7dfd2f9dffcb2f4746b1392280
|
|
| MD5 |
1f4049bff25876e2171d217a6e70eb3f
|
|
| BLAKE2b-256 |
6e70cfeae53c3c51a9916f8f26b156033596857f215eb3c44eb5e7a3ddf8ded1
|
File details
Details for the file python_cronet-0.1.6-cp39-cp39-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: python_cronet-0.1.6-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd2023e3583a902100872c204c96d18be2a1c801c3982d9b3a5121ccc4a395bd
|
|
| MD5 |
5eb9c0f4cae21d37a568429377220ec3
|
|
| BLAKE2b-256 |
8788b4367af698ddbd34ccab8a2663c09d9e9e40751a4a60fe0fe50c7cb806ef
|
File details
Details for the file python_cronet-0.1.6-cp38-cp38-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: python_cronet-0.1.6-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 14.0 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6910e40cc2ea33889d1798b065ba2136ee2708cb74d84e7e0697d20eddc1cc35
|
|
| MD5 |
9659459cb67611cc05e0fabb187e325b
|
|
| BLAKE2b-256 |
3bb6aa33b27910b976b04ad1a93e7ed9c957d253b9bd91871dc22b8e42c569ed
|