Metadata-Version: 2.1
Name: curlformat
Version: 0.1.2
Summary: Convert curl commands to Python HTTP client code
Home-page: https://github.com/ihandmine/curlformat
Author: handmine
Author-email: handmine@outlook.com
License: MIT
Keywords: curl
        requests
        httpx
        aiohttp
        pycurl
        curl_cffi
        http
        converter
        python3
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7.0
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0
Requires-Dist: pyperclip>=1.8.0
Requires-Dist: six>=1.15.0
Provides-Extra: aiohttp
Requires-Dist: aiohttp; extra == "aiohttp"
Provides-Extra: all
Requires-Dist: requests; extra == "all"
Requires-Dist: httpx; extra == "all"
Requires-Dist: aiohttp; extra == "all"
Requires-Dist: pycurl; extra == "all"
Requires-Dist: pyhttpx; extra == "all"
Requires-Dist: curl-cffi; extra == "all"
Requires-Dist: pyperclip; extra == "all"
Provides-Extra: curl_cffi
Requires-Dist: curl-cffi; extra == "curl-cffi"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Requires-Dist: build; extra == "dev"
Provides-Extra: httpx
Requires-Dist: httpx[http2]>=0.23.0; extra == "httpx"
Provides-Extra: pycurl
Requires-Dist: pycurl; extra == "pycurl"
Provides-Extra: pyhttpx
Requires-Dist: pyhttpx; extra == "pyhttpx"

# curlformat

A Python package to convert curl commands to Python HTTP client code.

## Features

- Convert curl commands to Python code for various HTTP libraries:
  - requests (default)
  - httpx (with sync and async support)
  - aiohttp
  - pycurl
  - pyhttpx
  - curl_cffi (with sync and async support)
- Parse curl commands from command line, clipboard, or stdin
- Support for headers, cookies, data, and more

## Installation

```bash
pip install curlformat
```

## Usage

### Command Line

```bash
# Basic usage (converts to requests)
curlformat 'curl -X GET "https://api.example.com"'

# Convert to httpx
curlformat --httpx 'curl -X GET "https://api.example.com"'

# Convert to async httpx
curlformat --httpx --async 'curl -X GET "https://api.example.com"'

# Convert to aiohttp
curlformat --aiohttp 'curl -X GET "https://api.example.com"'

# Read from clipboard if no curl command is provided
curlformat --httpx

# Read from stdin
cat curl_command.txt | curlformat --pycurl
```

### Python API

```python
from curlformat import parse

# Convert curl command to requests code
python_code = parse('curl -X GET "https://api.example.com"')
print(python_code)

# If httpx is installed
from curlformat import parse_httpx, parse_httpx_async

# Convert to httpx code
httpx_code = parse_httpx('curl -X GET "https://api.example.com"')
print(httpx_code)

# Convert to async httpx code
httpx_async_code = parse_httpx_async('curl -X GET "https://api.example.com"')
print(httpx_async_code)
```

## Optional Dependencies

The package has the following optional dependencies:

- `httpx`: For httpx support
- `aiohttp`: For aiohttp support
- `pycurl`: For pycurl support
- `pyhttpx`: For pyhttpx support
- `curl_cffi`: For curl_cffi support

You can install all optional dependencies with:

```bash
pip install curlformat[all]
```

Or install specific dependencies:

```bash
pip install curlformat[httpx,aiohttp]
```

## License

MIT
