Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
seananaidu committed Feb 16, 2017
1 parent 4b90bd1 commit 28c3a62
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scraper.py
Expand Up @@ -29,7 +29,15 @@
for el in page:
# # If the element is tagged as text, print our that text and its attribute
if el.tag == "text":
print el.text, el.attrib
if int(el.attrib['left']) < 60: data = { 'State': el.text }
elif int(el.attrib['left']) < 250: data = { 'Colonies_start': el.text }
elif int(el.attrib['left']) < 400: data = { 'Colonies_max': el.text }
elif int(el.attrib['left']) < 500: data = { 'Colonies_lost': el.text }
elif int(el.attrib['left']) < 560: data = { 'Percent_lost': el.text }
elif int(el.attrib['left']) < 660: data = { 'Colonies_added': el.text }
elif int(el.attrib['left']) < 760: data = { 'Colonies_renov': el.text }
elif int(el.attrib['left']) < 900: data = { 'Percent_renov': el.text}
print data
# # Write out to the sqlite database using scraperwiki library
# scraperwiki.sqlite.save(unique_keys=['name'], data={"name": "susan", "occupation": "software developer"})
#
Expand Down

0 comments on commit 28c3a62

Please sign in to comment.