Skip to main content

No project description provided

Project description

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)

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

pwbm-api-client-0.9.58.tar.gz (11.6 kB view details)

Uploaded Source

File details

Details for the file pwbm-api-client-0.9.58.tar.gz.

File metadata

  • Download URL: pwbm-api-client-0.9.58.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pwbm-api-client-0.9.58.tar.gz
Algorithm Hash digest
SHA256 db3674ee9f0fe3e021dd0f0091d1d6566c0491688b7589d38367c95afaa644e1
MD5 2ea66a9de9427d8bed5fee78154a87b2
BLAKE2b-256 87bc70b95a0f490f4d3c9e09b489b99e029be9e9e97c232e27983a7d489efcb4

See more details on using hashes here.

Supported by

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