Base

This is the base notebook for the istatapi package. It contains the code to make the API calls.

source

get_custom_ssl_session


def get_custom_ssl_session(
    
):

Get a session with a custom ssl context


source

CustomHttpAdapter


def CustomHttpAdapter(
    ssl_context:NoneType=None, kwargs:VAR_KEYWORD
):

Transport adapter” that allows us to use custom ssl_context.


source

ISTAT


def ISTAT(
    
):

Base class that provides useful functions to communicate with ISTAT API


source

ISTAT._request


def _request(
    path, kwargs:VAR_KEYWORD
):

Make a request to ISTAT API given a ‘path’

The ‘ISTAT’ class already implements the ‘base_url’, therefore ‘path’ only needs to include the other parameters of the request. Here is an example of a succesful request:

istat = ISTAT()
path = "dataflow/IT1"
test_response = istat._request(path=path)
test_response
<Response [200]>