Skip to main content

yet another library to convert request object to curl command

Project description

yet another library to convert request object to curl command

PyPI PyPI

Support request's objects from:

  • requests
  • httpx
  • httpx2 (adds --http2 to the curl)
  • aiohttp server
  • starlette/fastapi

Requires Python 3.10+.

Installation

pip install curlify3

Example

from curlify3 import to_curl
import requests

response = requests.get("http://google.ru")
print(to_curl(response.request))
# curl -H 'user-agent: python-requests/2.32.3' -H 'accept-encoding: gzip, deflate' -H 'accept: */*' -H 'connection: keep-alive' http://www.google.ru/

httpx2 (HTTP/2)

import httpx2
from curlify3 import to_curl

req = httpx2.Request("GET", "https://httpbin.org/get")
print(to_curl(req))
# curl --http2 -H 'host: httpbin.org' https://httpbin.org/get

async

import asyncio, httpx
from curlify3 import to_curl_async

req = httpx.Request("POST", "https://httpbin.org/post", json={"a": 1})
print(asyncio.run(to_curl_async(req)))

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

curlify3-0.6.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

curlify3-0.6-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file curlify3-0.6.tar.gz.

File metadata

  • Download URL: curlify3-0.6.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for curlify3-0.6.tar.gz
Algorithm Hash digest
SHA256 99ac4c1c404a6cb40ab9f2b0f5217d4289126a0c387ba937ee35762079b7c91c
MD5 98cc117872165a5e439341f573904120
BLAKE2b-256 d966b2fc23943010b1a797c6ad1ad309006863414acf72b6e3081cf72382aa54

See more details on using hashes here.

File details

Details for the file curlify3-0.6-py3-none-any.whl.

File metadata

  • Download URL: curlify3-0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for curlify3-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e54917ea0bde52b366029ad825a9894d1c477c08c9f14db5c0ffd6e7d571c88c
MD5 315de173a58beac79d90b7b5f1bb7fd2
BLAKE2b-256 c8f77dca086c86daa9d6066d1d1bc8667c6564419a45d7dc02d6f6eb77148da5

See more details on using hashes here.

Supported by

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