Skip to content

# ๐Ÿš€ cutieAPI - Your Friendly Command-Line API Client ๐Ÿš€ cutieAPI is a Python-based, interactive command-line tool designed to make API testing and interaction easy and enjoyable, right from your terminal! It's built with [Rich](https://github.com/Textualize/rich) for beautiful terminal output and `requests` for robust HTTP communication.

Notifications You must be signed in to change notification settings

samunder12/cutieAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ cutieAPI - Your Friendly Command-Line API Client ๐Ÿš€

cutieAPI is a Python-based, interactive command-line tool designed to make API testing and interaction easy and enjoyable, right from your terminal! It's built with Rich for beautiful terminal output and requests for robust HTTP communication.

Think of it as a lightweight, terminal-first companion for your API development workflow, similar in spirit to tools like Postman or Insomnia, but living entirely in your console.

๐ŸŽฌ Demo

Demo

โœจ Features

  • Interactive Request Building: Guided prompts for every step.
  • Multiple Body Types: JSON, Form Data, Raw Text, and File Uploads.
  • Pretty Output: Colorized, formatted, and syntax-highlighted responses.
  • Request History: Quickly re-run past requests.
  • Saved Requests: Store and load complex request configurations.
  • Environment Variables: Use placeholders like {{base_url}} for dynamic values.
  • Bearer Token Helper: Easy Authorization: Bearer <token> header management.
  • Save Response to File: Download API responses.
  • Cross-Platform: Works on Linux, macOS, and Windows.

๐Ÿ› ๏ธ Installation

  1. Prerequisites:

    • Python 3.8+
    • pip (Python package installer)
  2. Clone the Repository:

    git clone https://github.com/samunderSingh12/cutieAPI.git
    cd cutieAPI
  3. Install Dependencies: cutieAPI relies on requests and rich.

    pip install requests rich

    (Recommended: Use a virtual environment)

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install requests rich

๐Ÿš€ How to Use

  1. Run cutieAPI: Navigate to the directory containing main.py and run:

    python main.py

    You'll be greeted with the main menu:

    โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
    โ”‚ ๐Ÿš€ cutieAPI vX.X.X ๐Ÿš€ - Enhanced Edition โ”‚
    โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Configure New Request โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    Start with? [new/history/load/env/quit] (new):
    
  2. Initial Action - Choose Your Starting Point:

    • new (Default): Start building a request from scratch.
    • history: View past requests.
      Request History
      โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
      โ”ƒ # โ”ƒ Timestamp  โ”ƒ Method โ”ƒ URL                          โ”ƒ
      โ”กโ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
      โ”‚ 1 โ”‚ 2023-10-27 โ”‚ POST   โ”‚ http://localhost:8000/items/ โ”‚
      โ”‚ 2 โ”‚ 2023-10-27 โ”‚ GET    โ”‚ http://localhost:8000/ping   โ”‚
      โ””โ”€ Rerun Request โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
      Enter # to re-run (0 to cancel) (0): 1
      
    • load: Load a previously saved request configuration.
      Saved Requests
      โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
      โ”ƒ # โ”ƒ Request Name        โ”ƒ
      โ”กโ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
      โ”‚ 1 โ”‚ create_new_user     โ”‚
      โ”‚ 2 โ”‚ get_all_products    โ”‚
      โ””โ”€ Load Request โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
      Enter # to load (0 to cancel) (0): 1
      
    • env: Manage environment variables. You can add, remove, or list variables like {{base_url}} or {{auth_token}}.
      Action? [add/remove/list/done] (done): add
      Variable name (e.g., base_url): api_key
      Value for api_key: your_secret_api_key_here
      
    • quit: Exit cutieAPI.
  3. Define the Request Method & URL:

    Enter HTTP method [GET/POST/PUT/DELETE/PATCH/HEAD/OPTIONS] (GET): POST
    Enter the full API URL (e.g., {{base_url}}/items): {{base_url}}/items
    

    (cutieAPI will substitute {{base_url}} if you've defined it in env)

  4. Add Query Parameters (Optional):

    Manage query parameters? (y/N) [False]: y
    Current query parameters: None
    Enter query parameters one by one (e.g., limit=10)... Empty line to finish.
    Query Param (key=value, or empty to finish): page=1
    Query Param (key=value, or empty to finish): limit=20
    Query Param (key=value, or empty to finish):
    
  5. Manage Headers (Optional):

    Manage custom headers? (y/N) [False]: y
    Current headers: None
    Enter headers one by one... Empty line to finish.
    Header (or leave empty to finish): Content-Type: application/json
    Header (or leave empty to finish): X-Custom-Header: MyValue
    Header (or leave empty to finish):
    
    • Bearer Token Helper:
      Add/Update Bearer Token Authorization? (y/N) [False]: y
      Enter Bearer Token: your_jwt_token_here
      
  6. Specify Request Body (for POST, PUT, PATCH): You'll be prompted for the Request body type?.

    • json:
      Request body type? [json/form/file/raw/none] (json): json
      Enter JSON body. Ctrl+D (Unix) or Ctrl+Z+Enter (Windows) to finish.
      {
        "name": "cutieAPI Test",
        "value": 123,
        "tags": ["test", "{{env_tag}}"]
      }
      <Ctrl+D>
      
    • form (application/x-www-form-urlencoded):
      Request body type? [json/form/file/raw/none] (json): form
      Enter form data (key=value, one per line)... Empty line to finish.
      Form data (key=value, or empty to finish): username=cutie
      Form data (key=value, or empty to finish): type=api
      Form data (key=value, or empty to finish):
      
    • file (multipart/form-data):
      Request body type? [json/form/file/raw/none] (json): file
      Enter text fields for multipart form (key=value)... Empty line to finish.
      Text field (key=value, or empty to finish): description=Test upload
      Text field (key=value, or empty to finish):
      Add files for multipart form.
      Add/Update a file? (Y/n) [True]: y
      Form field name for the file (e.g., 'upload_file'): myFile
      Path to the file: /path/to/your/document.pdf
      
    • raw:
      Request body type? [json/form/file/raw/none] (json): raw
      Enter raw text body. Ctrl+D (Unix) or Ctrl+Z+Enter (Windows) to finish.
      <xml><message>Hello from cutieAPI!</message></xml>
      <Ctrl+D>
      
    • none: No request body will be sent.
  7. Review Sent Request & View Response: cutieAPI will display a summary of what's being sent, then the server's response:

    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Sending POST request to http://localhost:8000/items โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    Query Params: {'page': '1', 'limit': '20'}
    
    Headers Sent:
      Content-Type: application/json
      X-Custom-Header: MyValue
    
    JSON Body Sent:
    โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
    โ”ƒ 1 {                                                                          โ”ƒ
    โ”ƒ 2   "name": "cutieAPI Test",                                                 โ”ƒ
    โ”ƒ 3   "value": 123,                                                           โ”ƒ
    โ”ƒ 4   "tags": [                                                                โ”ƒ
    โ”ƒ 5     "test",                                                                โ”ƒ
    โ”ƒ 6     "beta"                                                                 โ”ƒ
    โ”ƒ 7   ]                                                                        โ”ƒ
    โ”ƒ 8 }                                                                          โ”ƒ
    โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Response Received (15.32 ms) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    Status Code: 201 Created
    
    Response Headers:
    โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
    โ”ƒ date               โ”ƒ Fri, 27 Oct 2023 10:00:00 GMT                         โ”ƒ
    โ”ƒ server             โ”ƒ uvicorn                                               โ”ƒ
    โ”ƒ content-type       โ”ƒ application/json                                      โ”ƒ
    โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ปโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›
    
    Response Body:
    โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
    โ”ƒ 1 {                                                                          โ”ƒ
    โ”ƒ 2   "id": 101,                                                               โ”ƒ
    โ”ƒ 3   "name": "cutieAPI Test",                                                 โ”ƒ
    โ”ƒ 4   "value": 123,                                                           โ”ƒ
    โ”ƒ 5   "tags": [                                                                โ”ƒ
    โ”ƒ 6     "test",                                                                โ”ƒ
    โ”ƒ 7     "beta"                                                                 โ”ƒ
    โ”ƒ 8   ],                                                                       โ”ƒ
    โ”ƒ 9   "message": "Item created successfully"                                   โ”ƒ
    โ”ƒ10 }                                                                          โ”ƒ
    โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›
    
  8. Post-Request Actions:

    • Save Response Body?: Prompts you to save the response content to a local file.
    • Save this request configuration?: Allows you to save the entire request setup (URL, headers, body, etc.) for quick loading later.
    • Make another request?: Choose to continue or exit cutieAPI.

๐Ÿ’พ Data Storage

  • History: ~/.api_buddy_history.json (stores last 50 requests).
    • Note: The filename still uses api_buddy. You might want to update this in the code (HISTORY_FILE variable) to ~/.cutieapi_history.json for consistency if you haven't already.
  • Saved Requests: ~/.api_buddy_saved_requests/
    • Note: Similarly, consider renaming this directory in code (SAVED_REQUESTS_DIR variable) to ~/.cutieapi_saved_requests/.

๐Ÿค Contributing

Contributions are welcome! Whether it's bug fixes, new features, or documentation improvements, please feel free to:

  1. Fork the repository.
  2. Create a new branch for your feature or fix (git checkout -b feature/your-feature-name).
  3. Make your changes and test them thoroughly.
  4. Commit your changes (git commit -am 'Add some feature').
  5. Push to the branch (git push origin feature/your-feature-name).
  6. Create a new Pull Request.

If you encounter any bugs or have feature suggestions, please open an issue on GitHub.

๐Ÿ“œ License

This project is open-source and available under the MIT License


Happy API Bashing with cutieAPI! ๐ŸŽ‰

About

# ๐Ÿš€ cutieAPI - Your Friendly Command-Line API Client ๐Ÿš€ cutieAPI is a Python-based, interactive command-line tool designed to make API testing and interaction easy and enjoyable, right from your terminal! It's built with [Rich](https://github.com/Textualize/rich) for beautiful terminal output and `requests` for robust HTTP communication.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages