Skip to main content

A Python client for Oxford Economics' Databank API.

Project description

oe-databank

PyPI version GitHub stars

Python expression of Oxford Economics' Databank API.

Installation

pip install oe-databank

Usage

Queries can be sent synchronously or asynchronously.

import asyncio
from oe_databank import (
    DatabankAsyncClient,
    DatabankClient,
    FileDownloadRequestDto,
    FileFormat,
    Frequency,
    ListingType,
    Order,
    Selection,
    SelectionSortOrder,
    SelectionType,
    Sequence,
)

request = FileDownloadRequestDto(
    selections=[
        Selection(
            selectionType=SelectionType.QUERY,
            isTemporarySelection=True,
            databankCode="IST",
            sequence=Sequence.EARLIEST_TO_LATEST,
            groupingMode=False,
            transposeColumns=False,
            order=Order.LOCATION_INDICATOR,
            indicatorSortOrder=SelectionSortOrder.ALPHABETICAL,
            locationSortOrder=SelectionSortOrder.ALPHABETICAL,
            format=0,
            legacyDatafeedFileStructure=False,
            variables=[],
            regions=[],
            listingType=ListingType.SHARED,
            isDataFeed=False,
            startYear=2023,
            endYear=2027,
            precision=5,
            frequency=Frequency.ANNUAL,
            stackedQuarters=False,
        )
    ],
    format=FileFormat.CSV,
    name="test-te-pull",
)

DatabankClient(api_key=...).query(request=request, to_path="sync_result.csv")

asyncio.run(DatabankAsyncClient(api_key=...).query(request=request, to_path="async_result.csv"))

You might run into issues with large downloads, so you can use retry options to handle errors during download.

from oe_databank import DatabankClient

DatabankClient(api_key=...).query(
    request=request,
    to_path="sync_result.csv",
    download_attempts=3,
    download_retry_delay_seconds=2.0,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oe_databank-0.2.0.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oe_databank-0.2.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file oe_databank-0.2.0.tar.gz.

File metadata

  • Download URL: oe_databank-0.2.0.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.7

File hashes

Hashes for oe_databank-0.2.0.tar.gz
Algorithm Hash digest
SHA256 60ae81ff337db7a6e978d2f4fd235bcdffe391332103605cefe2444e18f3021d
MD5 677ff2c4fc182e5fb33c37e9fc44acf7
BLAKE2b-256 f7f1d606b6ce2fc409e8311ae7644ede55af4d8b311f394f1b3ac049d75bfbf8

See more details on using hashes here.

File details

Details for the file oe_databank-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for oe_databank-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb33492a39a19dffd5f7717ad5d72a761bc0619422855bb551ddcd52881c7389
MD5 685ca7bb549287ec9be0fa1a5a7ecd20
BLAKE2b-256 43c318a46745e4404f7ceee73dc991ce1167a68072b3f3ac2e02fcac98ec2427

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page