Skip to main content

API Buddy

Build Status PyPI version

demo

Demo

demo

The most pleasant HTTP API CLI tool

  • Quick to set up
  • Easy to use
  • Automated OAuth2 sign-in
  • Copy/paste-able results

Installation

As long as you have python 3.13 or higher (I recommend using pyenv), just:

pip install api-buddy

Usage

First, specify the API you're exploring

api use https://some.api.com

Which will set the api_url value in your preferences file

# ~/.api-buddy.yaml
api_url: https://some.api.com

Then it's as easy as:

api get some-endpoint
=> 200
{
  "look": "I haz data",
  "thx": "API Buddy"
}

You can add query params in key=val format:

api get \
  my/favorite/endpoint \
  first_name=cosmo \
  last_name=kramer

You can also add request body data in JSON format:

api post \
  some-endpoint \
  '{"id": 1, "field": "value"}'

🤔 Note the single-quotes, which keeps your json as a sing continuous string. This means you can expand across multiple lines too:

api post \
  some-endpoint \
  '{
     "id": 1,
     "field": "value"
  }'

Variables can be interpolated within your endpoint, as part of values in your query params, or anywhere in your request body data, as long as they're defined by name in your preferences:

api post \
  'users/#{{user_id}}' \
  'name=#{{name}}' \
  '{
    "occupation": "#{{occupation}}"
  }'

👉 See all the helpful preferences here

Arguments

  • use: (optional) Set the base api_url you're exploring in your preferences file.
    • It come with the actual api_url value

If you're actually sending an HTTP request:

  • http_method: (optional) The HTTP method to use in your request.
    • It should be one of:
      • get
      • post
      • patch
      • put
      • delete
  • endpoint: (required) The relative path to an API endpoint.
    • AKA you don't need to type the base api url again here.
  • params: (optional) A list of key=val query params
  • data: (optional) A JSON string of requets body data.
    • You can't use this with get because HTTP.

Options

  • -h, --help: Show the help message
  • -v, --version: Show the installed version

Development

Requires:

Steps to start working:

  • Build and create the local venv with bin/setup
  • Make sure everything works with bin/test
  • Try the local cli with poetry run api --help
  • Find other management commands with bin/list

Note to self, publish flow is:

  • bin/bump
  • git add . && git commit -m 'Major/Minor/Patch bump x.x.x -> y.y.y'
  • bin/publish
  • git push
  • bin/tag

Metadata

Release files for api-buddy 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for api-buddy 1.0.1
File Size Uploaded
api_buddy-1.0.1.tar.gz 17.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for api-buddy 1.0.1
File Interpreter ABI Platform
api_buddy-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 42.2 kB

Release files / api_buddy-1.0.1.tar.gz

Download URL api_buddy-1.0.1.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c98a2fd21f558e863c1667da55685539a78845310a0e500be74f36ea52087f0b
BLAKE2b-256 checksum
How to use checksums
5ee4d188019c2d3570ea602bdedceecbf13d7b24bcb480ba78ab0d233b43d75a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.0 CPython/3.13.1 Darwin/24.2.0

Release files / api_buddy-1.0.1-py3-none-any.whl

Download URL api_buddy-1.0.1-py3-none-any.whl
Size 24.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0fd344a9d4d8a0579c6694046daca3651cbf12e10125c386f82449f136a8247
BLAKE2b-256 checksum
How to use checksums
0e58035f344280221b9e3211c510b1b57f9ecfa1c22531b3e092f42103fdcb6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.0 CPython/3.13.1 Darwin/24.2.0

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page