Skip to content

PyCurl is a lightweight, modern CLI tool written in Python that brings the power of curl with the ergonomics of Python's requests library.

License

Notifications You must be signed in to change notification settings

YashashavGoyal/pycurl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PyCurl

Python Typer Requests Rich

License GitHub stars GitHub issues

PyCurl is a lightweight, modern CLI tool written in Python that brings the power of curl with the ergonomics of Python's requests library. It provides a user-friendly command-line interface for making HTTP requests, managing authentication, and handling configurations.

How It Works

PyCurl mimics the simplicity of curl but adds structured output and state management.

flowchart LR
    User([πŸ‘€ User])
    CLI[("πŸ’» PyCurl CLI")]
    Config["βš™οΈ Config/Auth"]
    Network("🌐 Internet")
    
    subgraph Core ["πŸ”„ Core Logic"]
        direction TB
        Parser["πŸ“ Typer Parser"]
        Requester["πŸš€ Requests Engine"]
        Formatter["✨ Rich Formatter"]
    end

    User ==>|Command| CLI
    CLI --> Parser
    Parser <--> Config
    Parser --> Requester
    Requester <==>|HTTP/HTTPS| Network
    Requester --> Formatter
    Formatter -->|Pretty Output| User

    classDef plain fill:#1a1a1a,stroke:#fff,color:#fff;
    classDef highlight fill:#22226e,stroke:#f2f0f0,stroke-width:2px,color:#fff;
    class User plain;
    class CLI,Config highlight;
Loading

Features

  • Intuitive HTTP Methods: robust support for GET, POST, PUT, PATCH, DELETE.
  • Rich Output: Beautifully formatted JSON responses and error messages using rich.
  • Token Management:
    • Securely save and manage authentication tokens.
    • Support for custom aliases for tokens.
    • Insert tokens automatically into headers or cookies.
  • In-built Documentation: Interactive documentation viewer directly in the CLI.
  • Configuration System:
    • Persist settings across sessions.
    • Interactive configuration generation with pycurl config generate.
  • Cross-Platform: Works seamlessly on Windows, macOS, and Linux.

πŸš€ DevOps & Deployment

We use GitHub Actions for our CI/CD pipeline to ensure code quality and automated testing.

πŸ”„ CI/CD Pipeline

Our pipeline validates every commit:

  1. Testing: Runs unit and integration tests. (will be comming soon)
  2. Build: Verifies that the package builds correctly.

πŸ“₯ Download & Installation

Option 1: Download Pre-built Binary (Recommended)

You can download the latest standalone executable for your platform from the Releases page.

  1. Go to the Releases section.
  2. Download the version for your OS (Windows, Linux, or macOS).
  3. (Optional) Add the executable to your system PATH to run it from anywhere.

Option 2: Install via pip (Development)

Prerequisites: Python 3.10+

git clone https://github.com/YashashavGoyal/pycurl.git
cd pycurl
pip install .

πŸ› οΈ Usage

Initialization

Initialize your environment:

pycurl init

Making Requests

Simple GET Request

pycurl get https://jsonplaceholder.typicode.com/posts/1 --show-content

POST Request with JSON Data

pycurl post https://api.example.com/users --json '{"name": "Alice"}'

POST Request from File

pycurl post https://api.example.com/users --json @data.json

Authentication & Tokens

Save a token with an alias:

pycurl token set --alias myapi --token "your-token-here"

Use the saved token in a request:

pycurl get https://api.example.com/protected -U myapi

In-built Docs

View detailed documentation for any command:

pycurl docs get
pycurl docs post

πŸ“‚ Modular Code Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ commands/            # CLI Command Implementations
β”‚   β”‚   β”œβ”€β”€ docs/            # In-built Markdown Docs
β”‚   β”‚   β”œβ”€β”€ auth/            # Auth Management Logic
β”‚   β”‚   β”œβ”€β”€ config/          # Configuration Logic
β”‚   β”‚   β”œβ”€β”€ token/           # Token Management Logic
β”‚   β”‚   β”œβ”€β”€ get.py           # GET Command
β”‚   β”‚   β”œβ”€β”€ post.py          # POST Command
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ utils/               # Helpers (UI, Parsers, Auth Utils)
β”‚   └── main.py              # Application Entry Point
β”œβ”€β”€ .github/                 # CI/CD Workflows (Releases)
β”œβ”€β”€ pyproject.toml           # Metadata & Dependencies
└── README.md

Author: Yashashav Goyal

GitHub LinkedIn Twitter

License: MIT

About

PyCurl is a lightweight, modern CLI tool written in Python that brings the power of curl with the ergonomics of Python's requests library.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages