Get Started
Working with our API
GeoInsight API python package

Using our python library

Another way you could use our endpoints is to download our python library. To use our python library, you are required to use the GeoInsight Personal Token (GPT) and the API Private Key (APK) (read this if you haven't).

The library configuration can also be read here

Install

To install the package just run a regular pip install

pip install geoinsight

Usage

Then import the package like this.

import geoinsight

The GeoInsight package come with an api class to access the endpoints and a util class with additional useful functions. You can initialize both like this:

api=geoinsight.api()
util=geoinsight.util()

The api class wraps all API endpoints in python functions and util is a collection of methods that are useful to end-users, such as getting from r to a geopandas dataframe gdf, or to get the custom crs spherical map projection for any given gdf. The api class does not do any diagnostics, it is up to you and the context of your code to check if r comes back with a valid 200 http status code. Better write an if statement or a try-catch block if needed to check for r.status.

Tokens

Now use the GeoInsight Personal Token (GPT) and API Private Key (APK).

api.set_access_token(_gpt='GPT',_apk='APK')