8.23.2017

Use httpie to play with your APIs

Got tired of using curl. I switched to httpie.

1. Install
$ pip3 install httpie

2. I use jwt
$ pip3 install -U httpie-jwt-auth

3. First get token
$ http POST :8001/api-token-auth/ 'username=admin' 'password=abc123'

4. Now set env variables
$ export JWT_AUTH_TOKEN=your_token
$ export JWT_AUTH_PREFIX=JWT

5. Now do whatever
$ http --auth-type=jwt :8001/users/

6. If this error is encountered...
SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

Use --verify=no as in...

$ http --verify=no POST ...

No comments:

Post a Comment