https://github.com/jplusplus/viltolyckor_scraper
A scraper for statistical data from viltolyckor.se
https://github.com/jplusplus/viltolyckor_scraper
Last synced: 5 months ago
JSON representation
A scraper for statistical data from viltolyckor.se
- Host: GitHub
- URL: https://github.com/jplusplus/viltolyckor_scraper
- Owner: jplusplus
- License: mit
- Created: 2018-04-18T14:05:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-11T09:09:15.000Z (almost 6 years ago)
- Last Synced: 2025-10-27T02:45:23.326Z (8 months ago)
- Language: HTML
- Size: 14.6 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
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 `.
The scraper is limited to the data avialble through https://www.viltolycka.se/statistik/viltolyckor-for-respektive-viltslag/
Install
-------
.. code:: bash
$ pip install viltolyckor_scraper
Example usage
-------------
.. code:: python
from viltolyckor import ViltolyckorScraper
# Init scraper
scraper = ViltolyckorScraper()
# List all available datasets
datasets = scraper.items
# []
# Select a dataset
dataset = scraper.items["viltolyckor per viltslag"]
# List all available dimensions
datasets = verksamhetsform.dimensions
# [, , , ]
# 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:
.. code:: bash
$ pip install -r requirements.txt
Run tests:
.. code:: bash
$ 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.