本文整理汇总了Python中pupa.scrape.Bill.extras["additional_information"]方法的典型用法代码示例。如果您正苦于以下问题:Python Bill.extras["additional_information"]方法的具体用法?Python Bill.extras["additional_information"]怎么用?Python Bill.extras["additional_information"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pupa.scrape.Bill
的用法示例。
在下文中一共展示了Bill.extras["additional_information"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scrape
# 需要导入模块: from pupa.scrape import Bill [as 别名]
# 或者: from pupa.scrape.Bill import extras["additional_information"] [as 别名]
#.........这里部分代码省略.........
# they messed up Phil Mendelson's name
if name == "Phil Pmendelson":
name = "Phil Mendelson"
bill.add_sponsorship(name, classification='primary',
entity_type='person', primary=True)
for s in cosponsors:
name = s["Name"]
if name == "Phil Pmendelson":
name = "Phil Mendelson"
bill.add_sponsorship(name=name, classification="cosponsor",
entity_type='person', primary=False)
# if it's become law, add the law number as an alternate title
if "LawNumber" in legislation_info:
law_num = legislation_info["LawNumber"]
if law_num:
bill.add_title(law_num)
# also sometimes it's got an act number
if "ActNumber" in legislation_info:
act_num = legislation_info["ActNumber"]
if act_num:
bill.add_title(act_num)
# sometimes AdditionalInformation has a previous bill name
if "AdditionalInformation" in legislation_info:
add_info = legislation_info["AdditionalInformation"]
if "previously" in add_info.lower():
prev_title = add_info.lower().replace("previously", ""
).strip().replace(" ", "")
bill.add_title(prev_title.upper())
elif add_info:
bill.extras["additional_information"] = add_info
if "WithDrawnDate" in legislation_info:
withdrawn_date = self.date_format(legislation_info["WithDrawnDate"])
withdrawn_by = legislation_info["WithdrawnBy"][0]["Name"].strip()
if withdrawn_by == "the Mayor":
bill.add_action("withdrawn", withdrawn_date,
chamber="executive", classification="withdrawal")
elif "committee" in withdrawn_by.lower():
a = bill.add_action("withdrawn", withdrawn_date,
classification="withdrawal")
a.add_related_entity(withdrawn_by, entity_type='organization')
else:
a = bill.add_action("withdrawn", withdrawn_date,
classification="withdrawal")
a.add_related_entity(withdrawn_by, entity_type='person')
# deal with actions involving the mayor
mayor = bill_info["MayorReview"]
if mayor != []:
mayor = mayor[0]
if "TransmittedDate" in mayor:
transmitted_date = self.date_format(mayor["TransmittedDate"])
bill.add_action("transmitted to mayor", transmitted_date,
chamber="executive",
classification="executive-receipt")
if 'SignedDate' in mayor:
signed_date = self.date_format(mayor["SignedDate"])