User guide: programmatic access to the NIPI database and the Inflation NewsBot

Users can follow these simple steps to query our data in Python. These functionalities are available to trial users, albeit with some data limitation.



For some use cases, an automated access to our data may be warranted. We have compiled a few simple scripts to access and read the News Inflation Pressure Indices databases as well as the Inflation NewsBot.

If you don't have your login details or the URLs, please request them from us.

Make sure your usage is in line with your Data License, in particular make sure that the data remains accessible only by authorised users.

Access NIPI csv files

Our examples rely on the Pandas library, for its simplicity, but other csv reader should also do the work.

First, import the required libraries:

# imports
import io
import requests
import pandas as pd


Input your login credentials and the file location:

# credentials
csvurl = "https://www.alternativ.../filename.csv"
credentials = ("yourusername", "yourpassword")

To obtain the NIPI data:

# download as pandas dataframe
s = requests.get(csvurl, auth=credentials).content
df = pd.read_csv(io.StringIO(s.decode('utf-8')), index_col=0)
 

This will return a Dataframe with daily dates as the row index and the series short code as column names. The series code names can be found in the dictionary file NIPIdatadic.json on the NIPI page.

NewsBot

The daily Inflation NewsBot is currently available in the following formats: email, web page and JSON endpoint.

To access the JSON endpoint, you will also need your credentials and the associated URL. Using the requests library:

# imports
import requests
from requests.auth import HTTPBasicAuth 

# get request
response = requests.get("jsonfileurl",
                        auth=HTTPBasicAuth("yourusername", "yourpassword"))
data = response.json()

The returned "data" is a dictionary.


Don't hesitate to reach out for feedback or questions.