A Python library for the GovTrack.us API v2.
Project description
# govtrack-python
A Python library for the GovTrack.us API v2.
Based on https://github.com/markgx/govtrack-node/
For full API docs visit [https://www.govtrack.us/developers/api](https://www.govtrack.us/developers/api)
## Installation
```
pip install govtrack
```
## Usage
### Instantiate the GovTrackClient like so:
```
from govtrack.api import GovTrackClient
client = GovTrackClient()
```
### Calling the API:
##### 1. Choose an endpoint
```
client.bill()
client.cosponsorship()
client.person()
client.role()
client.vote()
client.vote_voter()
```
##### 2a. Filter the results
```
client.person({'lastname': 'Kennedy'})
```
##### 2b. Filter with a 'id' to get a single result (or get none if the 'id' doesn't exist)
```
client.person({'id': 123})
```
##### 2c. Provide an integer to get the same affect as 2b
```
client.person(123)
```
##### 3. Receive a response
Single response if you used an 'id':
```
{
'id': 65,
'bill_type': 'resolution',
'congress': 113
}
```
Multiple response if you used filters:
```
{
'meta': {
'some_meta_key_1': 123,
'some_meta_key_2': 'abc'
},
'objects': [
{
'id': 65,
'bill_type: 'resolution',
'congress': 113
},
{
'id': 66,
'bill_type': 'resolution',
'congress': 114
}
]
}
```
A Python library for the GovTrack.us API v2.
Based on https://github.com/markgx/govtrack-node/
For full API docs visit [https://www.govtrack.us/developers/api](https://www.govtrack.us/developers/api)
## Installation
```
pip install govtrack
```
## Usage
### Instantiate the GovTrackClient like so:
```
from govtrack.api import GovTrackClient
client = GovTrackClient()
```
### Calling the API:
##### 1. Choose an endpoint
```
client.bill()
client.cosponsorship()
client.person()
client.role()
client.vote()
client.vote_voter()
```
##### 2a. Filter the results
```
client.person({'lastname': 'Kennedy'})
```
##### 2b. Filter with a 'id' to get a single result (or get none if the 'id' doesn't exist)
```
client.person({'id': 123})
```
##### 2c. Provide an integer to get the same affect as 2b
```
client.person(123)
```
##### 3. Receive a response
Single response if you used an 'id':
```
{
'id': 65,
'bill_type': 'resolution',
'congress': 113
}
```
Multiple response if you used filters:
```
{
'meta': {
'some_meta_key_1': 123,
'some_meta_key_2': 'abc'
},
'objects': [
{
'id': 65,
'bill_type: 'resolution',
'congress': 113
},
{
'id': 66,
'bill_type': 'resolution',
'congress': 114
}
]
}
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
govtrack-0.1.tar.gz
(9.2 kB
view details)
File details
Details for the file govtrack-0.1.tar.gz
.
File metadata
- Download URL: govtrack-0.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b550229decfd317f6bf7d7cde304a3882723f8243475c7d6d6efbec0259c366e |
|
MD5 | 22894a2c0eda4ddbe17918a4e5817718 |
|
BLAKE2b-256 | a94c3d36ea332b5200aa3e2ff7eb53476ef4e6a8943153ac63c263036bac7fb6 |