Building/consuming web APIs is fundamental to web and mobile development. HTTP clients make working with web APIs a lot easier. Roughly speaking, HTTP clients fall into two categories: GUI apps, like Postman, Insomnia and Paw, and CLI apps like cURL and HTTPie.
Requester is an HTTP client for Sublime Text. It combines the "managed UI" features from GUI clients like collections, request history, env vars, syntax highlighting, request chaining, etc, with the speed of CLI clients. Everything is text, so sharing and versioning request collections is easy. It uses Requests' syntax, which is very nice and well documented.
I'd also like to show you how Requester works, how it uses Sublime Text to build a UI that combines the best of GUI and CLI, some of the cool things it does with Python, and how it could be improved by incorporating some "newish" Python features.
- Get Sublime Text 3
- Install Requester (not
Http Requester)
- Request Body, Query Params, Custom Headers, Cookies (see interactive tutorial)
- "Env" vars
- Syntax (Requests), plus convenience methods
- Request collections and navigation (fuzzy search!)
- Response tabs
- Request history (
ctrl+h
)
- It's text!
git
,GitHub
, etc- Env vars can go in a
.gitignore
d file, e.g.requester_env.py
- Env vars can go in a
- Export to cURL, HTTPie
- Import from cURL
- Debugging AJAX/XHR requests sent by your browser
- GraphQL support
- Test runner
- Benchmarking tool (like
ab
orsiege
)
- Parser
parse
takes a string, such as a selection from a view, returns a list of all calls torequests
in the string
- Eval and Exec
exec
used to build an env dict from a string, which is sort of howimport
populates a variables dict from a Python module- the
exec
ed string is a concatenation of env block and env file eval
used to parse args passed torequests.<http_method>
- e.g.
get
withfilename
argument
- e.g.
- This lets Requester modify, remove or add to args and kwargs before actually calling
requests
(seeprepare_request
)
- Requests run in parallel in a thread pool
- Syntax is Requests' syntax
- Sublime Text 4 is coming, which means plugins will run on Python 3.8 instead of 3.3
- Biggest new features are type annotations and
asyncio
- Type annotations would make the code base a lot easier to work with, especially for keeping track of the shape of data
- Benefits new contributors and maintainers
asyncio
would make it easy to improve the benchmarking tool so it can send lots of requests concurrently- This would require an async HTTP client library; fortunately there's HTTPX, whose syntax mirrors that of
requests
- This would require an async HTTP client library; fortunately there's HTTPX, whose syntax mirrors that of
asyncio
means we could build a websocket client using websockets- This would require a different design, because wss "full duplex" communication is different from HTTP request/response
- Text editor plugins can have very powerful UIs
- There ought to more UIs that mix GUI and text
- Someone ought to build Requester for VS Code, it could get big
- Build on top of stable, well-documented libraries
eval
andexec
have some cool usesasyncio
and type annotations have made Python a more scalable, versatile language