用于govtrack.us API的Python库
gt-p的Python项目详细描述
govtrack api(v2)的python包装器。
基于: -[https://github.com/cdelguercio/govtrack-python](https://github.com/cdelguercio/govtrack-python) -[https://github.com/markgx/govtrack-node/](https://github.com/markgx/govtrack-node/)
安装
pip install gt-py
用法
from gtpy.api import GTPY client = GTPY()
选择端点:
client.role() client.person() client.cosponsorship() client.vote client.bill() client.vote_voter() client.committee() client.committee_member()
找个人:
>>>PERSON_ID = 400045 >>>client.person(PERSON_ID) {‘birthday’: ‘1952-10-20’, ‘link’: ‘https://www.govtrack.us/congress/members/jeb_bradley/400045’, ‘lastname’: ‘Bradley’…
过滤结果,例如获得第144届国会投票通过的所有法案(支持过滤所有[可过滤字段](https://www.govtrack.us/developers/api)):
>>>CONGRESS_ID = 114 >>>client.bill({‘congress’: CONGRESS_ID})
改变最大结果数:
>>>client.bill({‘congress’: CONGRESS_ID, ‘limit’: 100})