TEC报告处理包
tx_tecreports的Python项目详细描述
与Texas Ethics Commission报表交互的python代码
注意
这还不能解释所有报告中的所有变化。 此消息将一直保留到收到为止。
用法
tx_tecreports从 Texas Ethics Commission。使用tx_tecreports.fetcher.get_report 这样地。
>>>fromtx_tecreports.fetcherimportget_report
只要你有正确的身份证,你就可以取任何报告 你可以拿温迪·戴维斯的第一份特别会议报告 (第一个是在她的阻挠之后提交的)身份是581606。 你可以通过访问 Texas Ethics Commission网站
>>>report=get_report(581606)
现在您可以通过 report.cover
>>>report.cover.type_of_filingu'COH-SS'>>>report.cover.is_originalTrue>>>report.cover.through_date-report.cover.from_datedatetime.timedelta(29)
你可以看到这是她的个人档案 文件管理器类型是:
>>>report.cover.filer.filer_typeu'IND'
真正有趣的数据在receipts属性中,一个列表 在本报告收到的所有捐款中。例如, 您可以通过查看它的 长度:
>>>len(report.receipts)1240
您可以创建任何给定日期的所有供款列表 通过这样看contribution.date:
>>>len([aforainreport.receiptsifa.contribution.date==report.cover.from_date])0
哦,看来她第一天就没有稿件了 关于那份报告我们改到最后一天:
>>>len([aforainreport.receiptsifa.contribution.date==report.cover.through_date])1187
更像是这样!
todo:将此示例充实为叙述文本的一部分
>>>fromtx_tecreports.fetcherimportget_filings_list>>>filings=get_filings_list("00062095COH")>>>len(filings)>=33# Has 33 filings as of January 2014True>>>report=filings[-1].report>>>len(report.receipts)157>>>report.total_receipts279284.94