本文整理汇总了Python中pupa.scrape.Bill.extras['wy_enrolled_number']方法的典型用法代码示例。如果您正苦于以下问题:Python Bill.extras['wy_enrolled_number']方法的具体用法?Python Bill.extras['wy_enrolled_number']怎么用?Python Bill.extras['wy_enrolled_number']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pupa.scrape.Bill
的用法示例。
在下文中一共展示了Bill.extras['wy_enrolled_number']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scrape_bill
# 需要导入模块: from pupa.scrape import Bill [as 别名]
# 或者: from pupa.scrape.Bill import extras['wy_enrolled_number'] [as 别名]
#.........这里部分代码省略.........
url = 'http://wyoleg.gov/{}'.format(bill_json['introduced'])
bill.add_version_link(note="Introduced",
url=url,
media_type="application/pdf" # optional but useful!
)
if bill_json['enrolledAct']:
url = 'http://wyoleg.gov/{}'.format(bill_json['enrolledAct'])
bill.add_version_link(note="Enrolled",
url=url,
media_type="application/pdf" # optional but useful!
)
if bill_json['fiscalNote']:
url = 'http://wyoleg.gov/{}'.format(bill_json['fiscalNote'])
bill.add_document_link(note="Fiscal Note",
url=url,
media_type="application/pdf" # optional but useful!
)
if bill_json['digest']:
url = 'http://wyoleg.gov/{}'.format(bill_json['digest'])
bill.add_document_link(note="Bill Digest",
url=url,
media_type="application/pdf" # optional but useful!
)
if bill_json['vetoes']:
for veto in bill_json['vetoes']:
url = 'http://wyoleg.gov/{}'.format(veto['vetoLinkPath'])
bill.add_version_link(note=veto['vetoLinkText'],
url=url,
media_type="application/pdf" # optional but useful!
)
for amendment in bill_json['amendments']:
# http://wyoleg.gov/2018/Amends/SF0050H2001.pdf
url = 'http://wyoleg.gov/{}/Amends/{}.pdf'.format(
session, amendment['amendmentNumber'])
if amendment['sponsor'] and amendment['status']:
title = 'Amendment {} ({}) - {} ({})'.format(
amendment['amendmentNumber'],
amendment['order'],
amendment['sponsor'],
amendment['status'],
)
else:
title = 'Amendment {} ({})'.format(
amendment['amendmentNumber'],
amendment['order'],
)
# add versions of the bill text
version = bill.add_version_link(
note=title,
url=url,
media_type="application/pdf",
)
version['extras'] = {
'amendmentNumber': amendment['amendmentNumber'],
'sponsor': amendment['sponsor'],
}
for sponsor in bill_json['sponsors']:
status = 'primary' if sponsor['primarySponsor'] else 'cosponsor'
sponsor_type = 'person' if sponsor['sponsorTitle'] else 'organization'
bill.add_sponsorship(
name=sponsor['name'],
classification=status,
entity_type=sponsor_type,
primary=sponsor['primarySponsor']
)
if bill_json['summary']:
bill.add_abstract(
note="summary",
abstract=bill_json['summary'],
)
if bill_json['enrolledNumber']:
bill.extras['wy_enrolled_number'] = bill_json['enrolledNumber']
if bill_json['chapter']:
bill.extras['chapter'] = bill_json['chapter']
if bill_json['effectiveDate']:
eff = datetime.datetime.strptime(
bill_json['effectiveDate'], '%m/%d/%Y')
bill.extras['effective_date'] = eff.strftime('%Y-%m-%d')
bill.extras['wy_bill_id'] = bill_json['id']
for vote_json in bill_json['rollCalls']:
yield from self.scrape_vote(bill, vote_json, session)
yield bill