The Veracode APIs require that you enable HMAC authentication for your Python application as a security measure for accessing API resources. The Python authentication library provides an integration between HTTPie and the Veracode APIs, which adds HMAC authentication when using the Veracode APIs from the command line.
You use the library to:
- Load the Veracode API credentials
- Generate an HMAC authorization header
- Issue an HTTP call to a Veracode API with a valid endpoint
The default HTTP method is
GET. For command examples, see REST APIs.
To download and install HTTPie, see https://httpie.org.
To learn more about HTTPie, you can run
http --help and review the HTTPie documentation. You can also get tips and examples from https://devhints.io/httpie.
HMAC authentication is the same for all calls, but the other aspects of authentication are specific to the API endpoint you want to call.
Debugging HTTPie with Python
After installing the HMAC library, if you use HTTPie and receive an error that includes:
pkg_resources.DistributionNotFound: The 'PySocks!=1.5.7,>=1.5.6; extra == "socks"' distribution was not found and is required by requests
Run this command to debug it:
pip install "PySocks!=1.5.7,>=1.5.6"