Skip to main content

haver-api

CircleCI version

PyPI Latest Release License Downloads Buy Me A Coffee

The haver-api library provides a convenient wrapper to Haver Analytics' RESTful API.

This library is not an official product of Haver Analytics and is not covered by its customer support. If you encounter any issue or have suggestions for improvements, please feel free to open an issue or submit a pull request.

Installation

pip install haver-api

❗❗❗ Notice ❗❗❗

The ownership of the old haver domain on PyPi (installable as pip install haver) has been passed on to Haver Analytics.

In order to install this library you now need to use the command above.

Running pip install haver will soon install Haver Analytics' library

How to

Connection and Authentication

from haver import Haver

haver = Haver(api_key='<your-haver-API-token>')

The class Haver also accepts keyword arguments to be passed to requests, which handles the connection to the API under the hood. In this way, by passing e.g. verify and proxy parameters, users can access Haver databases from behind firewalls. For example:

haver = Haver(api_key='<your-haver-API-key>',
              verify=False, # Or local path to certificates 
              proxies={'http': 'http://proxy-username:proxy-password@proxy-server.com:8080',
                       'https': 'http://proxy-username:proxy-password@proxy-server.com:8080'})

Instead of passing the API key explicitely each time, the user can also set an environmental variable HAVER_API_KEY containing the API key. In this case connection will be as simple as haver = Haver().

Obtaining your API Key

You can find your API key at this link.

Exploring available resources

All available databases can easily be listed as

haver.get_databases()

which will return a dictionary with keys the database names and values the corresponding database description:

{'UNPOP': 'U.N. Population Statistics',
 'EPFRECA': 'Fund Country Allocations',
 'EUFIN': 'Financial Data',
 ...
 }

Further information on each dataset can be obtained via the method haver.database_info, and series within each database can be listed e.g. as

haver.get_series(database='UNPOP', full_info=True)

Querying data

In order to retrieve data, the user has the option of querying one series at a time via the dedicated method

haver.read(database='EUDATA', series='N997CE')

which returns data in dictionary format, or querying multiple series as

haver.read_df(haver_codes=['N997CE@EUDATA','N025CE@EUDATA'])

where individual haver_codes are created by joining series and database names as {series}@{database}.

Author

Luca Mingarelli, 2018

Metadata

Release files for haver-api 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haver-api 0.9.0
File Size Uploaded
haver_api-0.9.0.tar.gz 30.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for haver-api 0.9.0
File Interpreter ABI Platform
haver_api-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 59.2 kB

Release files / haver_api-0.9.0.tar.gz

Download URL haver_api-0.9.0.tar.gz
Size 30.7 kB
Tags Source
SHA-256 checksum
How to use checksums
52fa177c6e1f1f18a8e486deb9cf72bdba7e5e9e735687396488c9a7b52508bb
BLAKE2b-256 checksum
How to use checksums
7a39f6f34ba1b81752d361cd697c180da630825f5e42a47f31776aeff4742356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / haver_api-0.9.0-py3-none-any.whl

Download URL haver_api-0.9.0-py3-none-any.whl
Size 28.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
56a2a47f32cee49e5623c89b2350a84798194c21330c908d16a47f16e96f70ac
BLAKE2b-256 checksum
How to use checksums
7ccf59d075831c760f6b143e76785dbce0b42288811b7d1cb3a4cd2cfdc62832
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page