prasanna malla
Posted on May 13, 2023
When testing APIs its easy to use curl
in your terminal but the output is definitely not pretty. We can pipe the command to python -m json.tool
and have it readable but we want it to be pretty)
We will be using homebrew
as the package manager to install pygments
and python
and use this as the default version with pyenv
. First we will uninstall any previous version of python installed eg: pyenv uninstall 3.10.5 && pyenv rehash
Let’s start brewing)
brew install @python3.11
cd ~/.pyenv/versions
ln -sfv "$(brew --prefix python@3.11)" 3.11
cd "$(brew --prefix python@3.11)"
ln -sfv Frameworks/Python.framework/Versions/3.11/include/python3.11 include
cd "$(brew --prefix python@3.11)/bin"
ln -sfv idle3 idle
ln -sfv pip3 pip
ln -sfv python3 python
ln -sfv wheel3 wheel
pyenv rehash
pyenv global 3.11
python --version
brew install pygments
Now we can pipe our API call to json.tool
for formatting and pygments
for JS like colorized output
curl -X GET ‘https://api.printful.com/store/products/307743308' | python -m json.tool | pygmentize -l javascript
Finally, I can get back to writing my next Vendure plugin for Printful! Follow me on twitter @prasmalla for updates on the plugin ✌️
Posted on May 13, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.