File tree Expand file tree Collapse file tree 1 file changed +11
-23
lines changed Expand file tree Collapse file tree 1 file changed +11
-23
lines changed Original file line number Diff line number Diff line change 1
- # This is a template for a Python scraper on morph.io (https://morph.io)
2
- # including some code snippets below that you should find helpful
1
+ import scraperwiki
2
+ import csv
3
+ data = scraperwiki .scrape ('https://www.sos.state.co.us/pubs/charities/reports/2016/tables/Table2-PaidSolicitorSummary2016.csv' )
4
+
5
+ reader = csv .DictReader (data .splitlines ())
6
+
7
+ for row in reader :
8
+ for key , value in row .iteritems ():
9
+ print key
3
10
4
- # import scraperwiki
5
- # import lxml.html
6
- #
7
- # # Read in a page
8
- # html = scraperwiki.scrape("http://foo.com")
9
- #
10
- # # Find something on the page using css selectors
11
- # root = lxml.html.fromstring(html)
12
- # root.cssselect("div[align='left']")
13
- #
14
- # # Write out to the sqlite database using scraperwiki library
15
- # scraperwiki.sqlite.save(unique_keys=['name'], data={"name": "susan", "occupation": "software developer"})
16
- #
17
- # # An arbitrary query against the database
18
- # scraperwiki.sql.select("* from data where 'name'='peter'")
19
-
20
- # You don't have to do things with the ScraperWiki and lxml libraries.
21
- # You can use whatever libraries you want: https://morph.io/documentation/python
22
- # All that matters is that your final data is written to an SQLite database
23
- # called "data.sqlite" in the current working directory which has at least a table
24
- # called "data".
11
+ print row ['Ref. No.' ]
12
+ scraperwiki .sqlite .save (['Ref. No.' ], row )
You can’t perform that action at this time.
0 commit comments