A client for the UK Parliament API. Python 3 only, contributions welcome.
Currently supports:
- Commons and Lords divisions
- Commons and Lords membership
- Early Day Motions
Installing
The package can be installed in the usual way with pip:
pip install ukparliament
Examples
Firstly, import and create the client:
>>> from ukparliament import Parliament
>>> parliament = Parliament()
Getting membership of houses:
>>> mps = parliament.commons.members.current()
>>> len(mps)
650
Lists of members can be broken down by party, but otherwise behave as normal Python lists:
>>> mps.by_party()
{<Party "Labour Party">: 257,
<Party "Conservative Party">: 315,
<Party "Scottish National Party">: 35,
<Party "Sinn Féin">: 7,
None: 1,
<Party "Liberal Democrats">: 12,
<Party "Democratic Unionist Party">: 10,
<Party "Plaid Cymru">: 4,
<Party "Independent">: 8,
<Party "Green Party">: 1}
Fetching divisions for a house:
>>> divisions = parliament.commons.recent_divisions(limit=4)
>>> division = divisions[0]
>>> division
<Commons division: "draft Double Taxation Relief and International Tax Enforcement (Jersey) Order 2018" on 2018-11-21>
Divisions contain vote totals:
>>> division.ayes, division.noes, division.passed
(302, 238, True)
You can also get the full lists of who voted:
>>> division.votes['aye'].by_party()
{<Party "Conservative Party">: 293,
<Party "Independent">: 3,
<Party "Democratic Unionist Party">: 6}
Metadata
Release files for ukparliament 0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ukparliament-0.6-py3-none-any.whl | Python 3 | none | any | Details for ukparliament-0.6-py3-none-any.whl |
Release files / ukparliament-0.6-py3-none-any.whl
| Download URL | ukparliament-0.6-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7119b4431f655022389e0039e06064502544fa09df49d5ad92d948506724f38
|
|
BLAKE2b-256 checksum How to use checksums |
794a035cc219df11a72c21e2ffa63f8f27f3b122b55699449ae2892e6d722b61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Security for ukparliament 0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.