Skip to main content

A simple curl clone in Python

Project description

cURLpy

A simple curl implementation built from scratch using Python 3.

The goal of this project is to use as few dependencies as possible — preferably none.

Current status: This project currently has no dependencies.

Installation

Install from PyPI:

pip install curlpy-nicolaszmarzagao

Usage

cURLpy works similarly to curl. Here are some features already implemented:

GET Requests

HTTP

python3 -m curlpy example.com

HTTPS

python3 -m curlpy https://example.com

Specific path

python3 -m curlpy https://example.com/hello/world

Specific port

python3 -m curlpy https://example.com:8080

Or:

python3 -m curlpy https://example.com/ -p 8080

Include HTTP headers

python3 -m curlpy example.com -i

POST Requests

Use the -d / --data flag to send data in the request body. This automatically makes it a POST request.

Form data

python3 -m curlpy example.com/api -d "name=john&age=30"

JSON

python3 -m curlpy example.com/api -d '{"name": "john"}' -H "Content-Type: application/json"

Override the method

-d defaults to POST, but you can override it with -X:

python3 -m curlpy example.com/api -d '{"name": "john"}' -X PUT

Local Development

Clone the repository using SSH:

git clone git@github.com:nicolaszmarzagao/curlpy.git
cd curlpy

Create and activate a virtual environment:

python3 -m venv .venv
source .venv/bin/activate

Install cURLpy locally in editable mode:

python3 -m pip install -e .

Run the tests:

python3 -m unittest discover -s tests -v

Run cURLpy:

python3 -m curlpy

Contributing

Feel free to fork this repository, open issues, suggest features, or contribute with pull requests.

This project is licensed under the MIT License.

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

curlpy_nicolaszmarzagao-0.1.3.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

curlpy_nicolaszmarzagao-0.1.3-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file curlpy_nicolaszmarzagao-0.1.3.tar.gz.

File metadata

  • Download URL: curlpy_nicolaszmarzagao-0.1.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for curlpy_nicolaszmarzagao-0.1.3.tar.gz
Algorithm Hash digest
SHA256 62501dabc6bf23dd35d4b2ed20dacecb412919ed316f14aead8fe0cc6926c3df
MD5 b6b884e085b9cb84a8c797c1a9d5d437
BLAKE2b-256 67e6ec5c09b4da790df73168f00e31ddccfce4326591881608868fe9108e7552

See more details on using hashes here.

File details

Details for the file curlpy_nicolaszmarzagao-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for curlpy_nicolaszmarzagao-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef9bed28f3f623e881e03288ebd250af00ae109350324965a6b0f2a622b4344
MD5 8a7ced915b19d26bee131a41761aa7e7
BLAKE2b-256 5df1ae0daec2a7eb51283c33c43973d46a473f63dcf979f59ba1e7495b754002

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