Skip to main content
Hero Light

Overview

The abstract-python library is a Python SDK for APIs by AbstractAPI. It contains helper classes that allow Python developers use these APIs without having to know the endpoints off-hand. It also does type validation on each request data before they are sent to the API server. This helps to manage credits, as each request costs a credit - whether successful or otherwise. This SDK currrently supports the Exchange Rates API, IP Geolocation API, and the VAT API.
This is not an official SDK by AbstractAPI but safe to use by anyone.

Quickstart

Installation

This page helps you to install the abstract-python library

Authentication

This page helps you to get api-keys to authenticate with the library

Exchange API

This API helps you to get real-time exchnage rates and much more between currencies

IP Geolocation API

This API helps you to retrive user’s location data with their IP address.

VAT API

This API helps you to calculate VAT fees for products in a country

Error handling

This page helps you to gracefully handle errors without crashing your app.

Response format

All responses are returned as a JSON object. Each response object has a status field that contains the response status code. Below is a sample response object for a successful request:

{
  // Other response data
  "status": 200
}
The status field is used to verify the request’s success.

Errors and exceptions

Errors in abstract-python are in two(2) variants.
  • Regular Python exceptions:
A common exception you will encounter is the TypeError, usually from wrong data types used in arguments.
  • JSON error messages:
These are JSON objects with detailed description of the error. They are often self-explanatory. Below is a sample error message:
// Authorization error

{
  "error": {
    "message":"A validation error occurred.",
    "code":"validation_error",
    "details":{
      "api_key":["This field may not be blank."],
      "country_code":["\"fu\" is not a valid choice."]
    }
  },
  "status": 401
}