Skip to main content

A scraper of statistical data from viltolyckor.se, built on top of Statscraper.

Project description

This is a scraper for statistical data from the (https://www.viltolycka.se/statistik/viltolyckor-for-respektive-viltslag/)[viltolycka.se] built on top of the Statscraper package <https://github.com/jplusplus/statscraper>.

The scraper is limited to the data avialble through https://www.viltolycka.se/statistik/viltolyckor-for-respektive-viltslag/

Install

$ pip install viltolyckor_scraper

Example usage

from viltolyckor import ViltolyckorScraper

# Init scraper
scraper = ViltolyckorScraper()

# List all available datasets
datasets = scraper.items
# [<ViltolyckorDataset: viltolyckor per viltslag>]

# Select a dataset
dataset = scraper.items["viltolyckor per viltslag"]

# List all available dimensions
datasets = verksamhetsform.dimensions
# [<Dimension: region>, <Dimension: year>, <Dimension: month>, <Dimension: viltslag>]

# Make a query
res = dataset.fetch()  # Get latest available data for whole country by default

# Analyze the results with Pandas
df = res.pandas

# Make a more specific query
# Get data for a given period
res = dataset.fetch({"period": "2015"})

# Or from a specific region (all years)
res = ds.fetch({"region": u"Stockholms län", "year": "*"})

Develop

Set up:

$ pip install -r requirements.txt

Run tests:

$ make tests

Deployment

To deploy a new version to PyPi:

  1. Update version in setup.py

  2. Build: python3 setup.py sdist bdist_wheel

  3. Upload: python3 -m twine upload dist/viltolyckor_scraper-X.Y.X*

…assuming you have Twine installed (pip install twine) and configured.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viltolyckor_scraper-0.2.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

viltolyckor_scraper-0.2.0-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page