https://github.com/nlecoy/curlparser
Parse cURL commands returning object representing the request.
https://github.com/nlecoy/curlparser
curl parser
Last synced: 7 months ago
JSON representation
Parse cURL commands returning object representing the request.
- Host: GitHub
- URL: https://github.com/nlecoy/curlparser
- Owner: nlecoy
- License: apache-2.0
- Created: 2021-05-30T12:30:33.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-18T04:19:04.000Z (about 3 years ago)
- Last Synced: 2025-06-06T22:18:10.821Z (8 months ago)
- Topics: curl, parser
- Language: Python
- Homepage:
- Size: 45.9 KB
- Stars: 6
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cURL Parser
Parse cURL commands returning object representing the request.
## How to install?
`curlparser` is available on PyPi:
### Using pip
```shell
$ pip install curlparser
```
### Using poetry
```shell
$ poetry add curlparser
```
### Using pipenv
```shell
$ pipenv install curlparser
```
## How to use?
```python
>>> import curlparser
>>> result = curlparser.parse(
"""
curl \
--header 'Content-Type: application/json' \
--request PUT \
--user nlecoy:my_password \
--data '{"username":"xyz", "password":"xyz"}' \
https://api.github.com/repos/nlecoy/curlparser
"""
)
>>> result.url
'https://api.github.com/repos/nlecoy/curlparser'
>>> result.auth
('nlecoy', 'my_password')
>>> result.json
{'username': 'xyz', 'password': 'xyz'}
```
## Available parameters
`curlparser`'s parse method will return a `ParsedCommand` object containing the following fields:
- method
- url
- auth
- cookies
- data
- json
- header
- verify
## License
cURL Parser is distributed under the Apache 2.0. See [LICENSE](LICENSE) for more information.