# scraperwiki-python **Repository Path**: jamesxia4/scraperwiki-python ## Basic Information - **Project Name**: scraperwiki-python - **Description**: ScraperWiki Python library for scraping and saving data - **Primary Language**: Unknown - **License**: BSD-2-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2014-12-31 - **Last Updated**: 2021-11-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
This is a Python library for scraping web pages and saving data. It is the easiest way to save data on the ScraperWiki platform, and it can also be used locally or on your own servers.
pip install scraperwiki
Returns the downloaded string from the given url.
params are sent as a POST if set.
user_agent sets the user-agent string if provided.
Helper functions for saving and querying an SQL database. Updates the schema automatically according to the data you save.
Currently only supports SQLite. It will make a local SQLite database. It is based on the Python module dumptruck. You should expect it to support other SQL databases at a later date.
Saves a data record into the datastore into the table given by table_name.
data is a dict object with field names as keys; unique_keys is a subset of data.keys() which determines when a record is overwritten.
For large numbers of records data can be a list of dicts.
Executes any arbitrary SQL command. For example CREATE, DELETE, INSERT or drop.
vars is an optional list of parameters, inserted when the SQL command contains ‘?’s. For example:
scraperwiki.sql.execute("INSERT INTO swdata VALUES (?,?,?)", [a,b,c])
The ‘?’ convention is like "paramstyle qmark" from Python's DB API 2.0 (but note that the API to the datastore is nothing like Python's DB API). In particular the ‘?’ does not itself need quoting, and can in general only be used where a literal would appear.
Executes a select command on the datastore. For example:
scraperwiki.sql.select("* FROM swdata LIMIT 10")
Returns a list of dicts that have been selected.
vars is an optional list of parameters, inserted when the select command contains ‘?’s. This is like the feature in the .execute command, above.