Skip to main content

EveryPolitician

A Python library for easy access to EveryPolitician data. This is essentially a Python port of everypolitican-ruby.

This has been tested with Python 2.7 and Python 3.5.

Installation

You can install this package from PyPi with:

pip install everypolitician

Usage

Creating a instance of the EveryPolitican class allows you to access information on countries, their legislatures and legislative periods. Each country and legislature has a slug that can be used to reference them via the country and legislature methods:

from everypolitician import EveryPolitician
ep = EveryPolitician()

australia = ep.country('Australia')
senate = australia.legislature('Senate')
senate # => <Legislature: Senate in Australia>

united_kingdom = ep.country('UK')
house_of_commons = united_kingdom.legislature('Commons')

american_samoa = ep.country('American-Samoa')
house_of_representatives = american_samoa.legislature('House')

for country in ep.countries():
    print country.name, 'has', len(country.legislatures()), 'legislatures'

By default this will get the EveryPolitician data and returns the most recent data. This data is found from the index file, called countries.json, which links to specific versions of other data files.

If you want want to point to a different countries.json file, you can override the default URL by specifying the countries_json_url keyword argument when creating the EveryPolitician object, e.g.:

EveryPolitician(countries_json_url='https://cdn.rawgit.com/everypolitician/everypolitician-data/080cb46/countries.json')

The example above is using a specific commit (indicated by the hash 080cb46). If you want to use a local copy of countries.json you can create the object with the countries_json_filename keyword argument instead, e.g.:

EveryPolitician(countries_json_filename='/home/mark/tmp/countries.json')

For more about countries.json, see this description.

Remember that EveryPolitician data is frequently updated — see this information about using EveryPolitician data.

More information on the EveryPolitician site.

Development

After cloning the repo, you can run the tests on Python 2.7 and Python 3.5 by running:

tox

Or you can create a virtualenv and install the package’s dependencies with:

pip install -e .

And run the tests on the Python version your virtualenv was based on with:

pytest

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/everypolitician/everypolitician.

License

The gem is available as open source under the terms of the MIT License.

Metadata

Release files for everypolitician 0.0.13

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

Source distribution (sdist)

Source distribution for everypolitician 0.0.13
File Size Uploaded
everypolitician-0.0.13.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for everypolitician 0.0.13
File Interpreter ABI Platform
everypolitician-0.0.13-py2-none-any.whl Python 2 none any Details

Total release size: 11.8 kB

Release files / everypolitician-0.0.13.tar.gz

Download URL everypolitician-0.0.13.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
62c036101dc6e65eca867670c49b6ab0e84c9b1192ce626952d73b7a3130ec31
BLAKE2b-256 checksum
How to use checksums
31e072f7e77923d46d7e9ee204b4cc97288575f97ab11b57b4417c0f42b6ad6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / everypolitician-0.0.13-py2-none-any.whl

Download URL everypolitician-0.0.13-py2-none-any.whl
Size 7.1 kB
Tags Python 2
SHA-256 checksum
How to use checksums
f417f65ed44109d8e14a47c29fae5b2cc94385b0df03265e0b146f022f2caa75
BLAKE2b-256 checksum
How to use checksums
7430c00ad424f0b6a2be72a1db9351502fd1f2584564be7b9f2fbc93c6cc5167
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.13 This release

2 release files

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

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