Skip to main content

A python API for the Washington State Legislature web services

Project description

wa-leg-api

Python wrapper library around Washington State Legislature web services API

Installation

pip install wa-leg-api

Dependecies are:

Basic Usage

The stub functions are in modules named after each service in all lower case. The function names are the request type changed from CamelCase to snake_case.

Example: If you want to call the function GetAmendments from the AmendmentService, do:

from wa_leg_api.amendment import get_amendments
result = get_amendments(2021)

All stubs return dicts.

For more information about the Washington State Legislature web services available visit wslwebservices.leg.wa.gov

Exceptions

There is one exception defined by this library:

try:
    result = get_amendments(2100)  # an invalid year!
except WaLegApiException as e:
    print(e.http_error)      # HTTP Error code
    print(e.http_error_text) # HTTP Error code as text
    print(e.http_text)       # Additional text returned from leg.wa.gov 
    print(e.args_sent)       # Record of arguments sent with request

Sample output:

500
Internal Server Error
System.Web.Services.Protocols.SoapException: Invalid Input. ---> System.ArgumentException: You have not submitted a valid year.  Please enter year in the following format:  YYYY.  Information is only available back to 1991.
Parameter name: Year
   --- End of inner exception stack trace ---
   at WslWebServices.AmendmentService.GetAmendments(Int32 year)

{'year': 2100}

Exceptions thrown directly by the requests package are not re-wrapped.

Full documentation

Please visit https://wa-leg-api.readthedocs.io

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

wa_leg_api-0.1.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

wa_leg_api-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file wa_leg_api-0.1.0.tar.gz.

File metadata

  • Download URL: wa_leg_api-0.1.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

File hashes

Hashes for wa_leg_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c4ca1dc0a72d7e6946354d36c355dd7e0c0fe54c37b55819fef116206fcb0c61
MD5 5d3e0cdcea9af4a2c4090bafa9de65b9
BLAKE2b-256 e3d6eb138ef149c71dec042fed51a976c15c08f7ee185458e6d5c18cef2ee971

See more details on using hashes here.

File details

Details for the file wa_leg_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wa_leg_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

File hashes

Hashes for wa_leg_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3c0ad3f24dbbe5c4e2a13d49d98e56e9608b643b57934e1be2ee84fc3c9e628
MD5 20749aee2f99f5bcf10a3c19daa1712c
BLAKE2b-256 77c6c063d6f459a0cdcedbef723bacb5b80436e84818d617ff26fb530d771b6a

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