This release is a pre-release and may not be stable for production use.
delta-scraper
IN EARLY DEVELOPMENT
Python library for scraping data sources and creating readable deltas.
For background, see Scraping hurricane Irma.
Concepts
This library allows you to define scrapers, which are objects that know how to retrieve information from a source (usually a web API, but scrapers can be written to operate against HTML or other formats) and persist that data somewhere as JSON.
When a scraper fetches fresh information it has the ability to compare that data to the old data and use the difference to create a human-readable message.
These capabilities can be combined with a git repository to create a commit log, with human-readable commit messages that accompany a machine-readable diff againts the generated JSON.
See disaster-scrapers and disaster-data for some examples of this pattern in action.
Basic usage
You can define new scrapers by subclassing DeltaScraper. Here's an example which scrapes a list of FEMA shelters.
class FemaShelters(DeltaScraper):
url = "https://gis.fema.gov/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=FEMA:FEMANSSOpenShelters&maxFeatures=250&outputFormat=json"
owner = "simonw"
repo = "disaster-data"
filepath = "fema/shelters.json"
record_key = "SHELTER_ID"
noun = "shelter"
def fetch_data(self):
data = requests.get(self.url, timeout=10).json()
return [feature["properties"] for feature in data["features"]]
def display_record(self, record):
display = []
display.append(
" {SHELTER_NAME} in {CITY}, {STATE} ({SHELTER_STATUS})".format(**record)
)
display.append(
" https://www.google.com/maps/search/{LATITUDE},{LONGITUDE}".format(
**record
)
)
display.append(" population = {TOTAL_POPULATION}".format(**record))
display.append("")
return "\n".join(display)
Metadata
Release files for delta-scraper 0.1a1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| delta_scraper-0.1a1-py3-none-any.whl | Python 3 | none | any | Details for delta_scraper-0.1a1-py3-none-any.whl |
Release files / delta_scraper-0.1a1-py3-none-any.whl
| Download URL | delta_scraper-0.1a1-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88b863a1a436f184799aad0f2325bd3bab9c0e5d1c3a534779fd494734048a26
|
|
BLAKE2b-256 checksum How to use checksums |
9004082f6b9b55c85a82f3c354ea3b7ea29075cce0984b2782a6acee7b7ee16e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
|
Security for delta-scraper 0.1a1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.