Created
July 13, 2020 16:42
-
-
Save dyerrington/6850e459c37b3f01e4049505c1634256 to your computer and use it in GitHub Desktop.
Debugged fetch_states for Cesar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fetch_states(): | |
""" | |
Return all <option> values for the <select> element with all states. | |
""" | |
data = {} | |
states = tree.xpath('//select[@name="state"]') | |
try: | |
for state in states[0].xpath('option'): | |
data[state.attrib['value']] = state.text_content() | |
except: | |
raise IndexError("Offset not found in states:", states) | |
return data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment