Skip to main content

Python client for PWBM-API

Requirements

Tool implemented for Python version >= 3.8

Installation instruction

Install Python package:

Execute following command:

pip install pwbm-api-client

Import package and use it

from pwbm_api.client import Client
from pwbm_api import Series, Table

Examples of usage:

from pwbm_api.client import Client
from pwbm_api import Series, Table

client = Client()

# series filtration example
response = client.get(
    Series.query().filter(
        frequencies=['Annual'],
        relates_to_table=True,
        sources=['Internal Revenue Service'],
        tags=[{'name': 'Metric'}],
        uoms=['Items'],
        date_range='2015-12-31--2020-01-01'
    ).order_by(field='name', order='desc')  # permitted field name: 'name', 'uom', 'frequency', 'source', 'start_date', 'end_date'
)

for series in response:
    print(series)

# series search example by multiple search queries
response = client.get(
    Series.query(search_text=['Pennsylvania', 'Business Application']).filter(
        relates_to_table=True,
        sources=['Centers for Disease Control and Prevention'],
        frequencies=['Annual']
    ).filter(
        uoms=['Items'],
        tags=[{'name': 'State'}]
    ).order_by(
        field='name', order='desc'  # permitted field name: 'name', 'uom', 'frequency', 'source', 'start_date', 'end_date'
    )
)

for series in response:
    print(series)

# series search by neum example
response = client.get(
    Series.query(
        neum='Nebraska, Pneumonia and COVID-19 Deaths'
    ).filter(
        sources=['Centers for Disease Control and Prevention'],
        relates_to_table=True
    ).filter(
        frequencies=['Annual'],
        uoms=['People'],
        date_range='2020--2022'
    ).order_by(field='name')
    # permitted field name: 'name', 'uom', 'source', 'start_date', 'end_date', 'row_ver'
)

for series in response:
    print(series)

# get series by ids example
response = client.get(
    Series.query(
        ids=[
            '6cf73546-b8a9-4dbc-978a-4ff91bff8b07',
            'faf42b55-52b3-4ac1-9824-b3126c09ac41',
        ]
    ).filter(
        sources=['CDC'],
        frequencies=['Weekly Ending Sunday'],
        uoms=['People'],
        date_range='2020-01-01--2020-06-01'
    ).order_by(field='name')
    # permitted field name: 'name', 'uom', 'source', 'start_date', 'end_date'
)

for series in response:
    print(series)

# tables filtration example
response = client.get(
    Table.query().filter(
        sources=['Fire Administration']
    ).order_by(field='name')  # permitted field name: 'name', 'source'
)

for table in response:
    print(table)

# tables search example by multiple search queries
response = client.get(
    Table.query(
        search_text=['Other Residential Building']
    ).filter(
        sources=['Fire Administration']
    ).order_by(field='name', order='desc')  # permitted field name: 'name', 'source'
)

for table in response:
    print(table)

# get tables by ids example
response = client.get(
    Table.query(
        ids=['b9746501-aed4-4287-b109-ecb6c6ad39ad', '579b9e3f-cae4-4da0-81c6-234c334e769a']
    ).filter(
        sources=['Fire Administration']
    ).order_by(field='source', order='asc')  # permitted field name: 'name', 'source'
)

for table in response:
    print(table)

# tables search by neum example
response = client.get(
    Table.query(
        neum='Pennsylvania'
    ).filter(
        sources=['Internal Revenue Service']
    ).order_by(field='name', order='desc')  # permitted field name: 'name', 'source', 'row_ver'
)

for table in response:
    print(table)

Release files for pwbm-api-client 0.9.58

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

Source distribution (sdist)

Source distribution for pwbm-api-client 0.9.58
File Size Uploaded
pwbm-api-client-0.9.58.tar.gz 11.6 kB Details

Release files / pwbm-api-client-0.9.58.tar.gz

Download URL pwbm-api-client-0.9.58.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
db3674ee9f0fe3e021dd0f0091d1d6566c0491688b7589d38367c95afaa644e1
BLAKE2b-256 checksum
How to use checksums
87bc70b95a0f490f4d3c9e09b489b99e029be9e9e97c232e27983a7d489efcb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.9.58 This release

1 release file

0.9.57

1 release file

0.9.56

1 release file

0.8.13

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.0

1 release file

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