All Projects → ilias-ant → pydatagovgr

ilias-ant / pydatagovgr

Licence: MIT license
A Pythonic client for the official https://data.gov.gr API.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pydatagovgr

My.Jdownloader-API-Python-Library
My.Jdownloader API Python Library
Stars: ✭ 65 (+71.05%)
Mutual labels:  pip
GTFS
Public transport data in GTFS format with schemas, a data package and tests
Stars: ✭ 20 (-47.37%)
Mutual labels:  open-data
ocorrencias-transito-pmsp
Dados abertos sobre ocorrências de trânsito na cidade de São Paulo
Stars: ✭ 13 (-65.79%)
Mutual labels:  open-data
pipyuan
pipyuan 内置了国内常用的 pip 源, 你可以快速设置想要的源
Stars: ✭ 30 (-21.05%)
Mutual labels:  pip
whyqd
data wrangling simplicity, complete audit transparency, and at speed
Stars: ✭ 16 (-57.89%)
Mutual labels:  open-data
adresse.data.gouv.fr
Le site officiel de l'Adresse
Stars: ✭ 139 (+265.79%)
Mutual labels:  open-data
ochrona-cli
A command line tool for detecting vulnerabilities in Python dependencies and doing safe package installs
Stars: ✭ 46 (+21.05%)
Mutual labels:  pip
etymology-db
An open etymology dataset created using Wiktionary data. Contains 3.8M entries, 1.8M terms, 2900 languages, and 31 unique relationship types.
Stars: ✭ 20 (-47.37%)
Mutual labels:  open-data
animec
A module to get data about anime characters, news, info, lyrics and more.
Stars: ✭ 31 (-18.42%)
Mutual labels:  pip
dw-jdbc
JDBC driver for data.world
Stars: ✭ 17 (-55.26%)
Mutual labels:  open-data
pipm
Python dependency management workflow using setup.cfg and requirements files without reinventing the wheels
Stars: ✭ 30 (-21.05%)
Mutual labels:  pip
website-old
The Frictionless Data website.
Stars: ✭ 31 (-18.42%)
Mutual labels:  open-data
wikdict-gen
Generation of bilingual dictionaries from Wiktionary/dbnary data for the WikDict project
Stars: ✭ 32 (-15.79%)
Mutual labels:  open-data
Python-Course
🐍 This is the most complete course in Python, completely practical and all the lessons are explained with examples, so that they can be easily understood. 🍫
Stars: ✭ 18 (-52.63%)
Mutual labels:  pip
YoutubeFloatingVideo
Simple Youtube Floating Video Library
Stars: ✭ 37 (-2.63%)
Mutual labels:  pip
trusat-frontend
The React codebase for space-sustainability tool TruSat
Stars: ✭ 31 (-18.42%)
Mutual labels:  open-data
dashmap.io
DashMap is an open source web platform that gathers, analyses and visualises urban data.
Stars: ✭ 36 (-5.26%)
Mutual labels:  open-data
p4python
[Officially Supported] P4Python is a wrapper for the P4 C++ API in Python.
Stars: ✭ 30 (-21.05%)
Mutual labels:  pip
OSODOS
Open Science, Open Data, Open Source
Stars: ✭ 23 (-39.47%)
Mutual labels:  open-data
meta-package-manager
🎁 a wrapper around all package managers
Stars: ✭ 277 (+628.95%)
Mutual labels:  pip

pydatagovgr

PyPI PyPI - Python Version codecov Code style: black GitHub Workflow Status Documentation Status PyPI - Wheel

A Pythonic client for the official data.gov.gr API. Aims to be an easy, intuitive and out-of-the-box way to:

  • find data published by central government, local authorities and public bodies of Greece
  • build related products and services.

while being robust, following best-practices and eliminating developer-induced bugs.

The aspiration for this library is to enable users of different backgrounds (academia, industry, students etc.) with an interest to programmatically explore and utilize the open data of data.gov.gr, to do so without having to write-debug-maintain trivial code or worry about that.

Install

The recommended installation is via pip:

pip install pydatagovgr

Quick Usage

You must have an account on data.gov.gr to use the API service. In order to register and request an API token, submit a request in the designated official form here. The procedure is very simple and takes less than 5 minutes.

from pydatagovgr import DataGovClient


gov = DataGovClient(token='xoxb-1234-1243')

# fetch the COVID-19 vaccination data
covid_data = gov.query('mdg_emvolio')

# fetch data on Greece's internet traffic
traffic_data = gov.query('internet_traffic')

# fetch a list of the forest fires
fire_data = gov.query('mcp_forest_fires')

Features

The pydatagovgr client supports out-of-the-box all the things you know (and love), such as:

  • authentication: properly handles the authentication to data.gov.gr - all you have to do is provide a valid token.
  • persistent session: making several requests to data.gov.gr reuses the same underlying connection.
  • timeout policy: informs data.gov.gr that it will await at most x seconds for a response for a given request. Defaults to 60 sec.
  • retry policy: to account for potential server failures of lossy network connections, client automatically retries with an exponential-backoff, to avoid harming the data.gov.gr. Defaults to a maximum of 3 retries.

Not-So-Quick Usage

The data.gov.gr API exposes, through its api/v1/query GET endpoint, various datasets from different topics.

The pydatagovgr client thus provides a corresponding query method, through which every available dataset can be obtained. You can also pass additional arguments to filter the results accordingly.

from pydatagovgr import DataGovClient


gov = DataGovClient(token='xoxb-1234-1243')

# fetch the COVID-19 vaccination data for the 2021
data = gov.query('mdg_emvolio', date_from='2021-01-01', date_to='2021-12-31')

You can also use Python objects as arguments:

import datetime


data = gov.query(
    'mdg_emvolio', 
    date_from=datetime.date(2021, 1, 1), 
    date_to=datetime.date(2021, 12, 31)
)

Apart from the authentication token, you can also configure the timeout and retry policies of your client. For example:

# this client will stop waiting for a response after 7 seconds 
gov = DataGovClient(token='xoxb-1234-1243', timeout=7)

# this client will retry at most 3 times, with an exponential-backoff
# (i.e. each retry waits exponentially longer before occurs: 1, 2, 4, 8, ...sec)
gov = DataGovClient(token='xoxb-1234-1243', max_retries=3)

# this client will respect both a timeout policy and a retry policy
gov = DataGovClient(token='xoxb-1234-1243', timeout=7, max_retries=3)

Related Projects

How to contribute

If you wish to contribute, this is a great place to start!

License

Distributed under the MIT License.

Acknowledgements

All rights are reserved by the official https://data.gov.gr site, its developers, its maintainers and the Hellenic Government.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].