pydatagovgr


Namepydatagovgr JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://pypi.org/project/pydatagovgr
SummaryA Pythonic client for the official https://data.gov.gr API.
upload_time2025-07-25 14:53:48
maintainerNone
docs_urlNone
authorilias-ant
requires_python<3.13,>=3.9
licenseMIT
keywords client pip govgr open-data
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # pydatagovgr

[![PyPI](https://img.shields.io/pypi/v/pydatagovgr?color=blue&label=PyPI&logo=PyPI&logoColor=white)](https://pypi.org/project/pydatagovgr/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pydatagovgr?logo=python&logoColor=white)](https://www.python.org/) [![codecov](https://codecov.io/gh/ilias-ant/pydatagovgr/branch/main/graph/badge.svg?token=2H0VB8I8IH)](https://codecov.io/gh/ilias-ant/pydatagovgr) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ilias-ant/pydatagovgr/ci.yml?branch=main)](https://github.com/ilias-ant/pydatagovgr/actions/workflows/ci.yml) [![Documentation Status](https://readthedocs.org/projects/pydatagovgr/badge/?version=latest)](https://pydatagovgr.readthedocs.io/en/latest/?badge=latest)
 [![PyPI - Wheel](https://img.shields.io/pypi/wheel/pydatagovgr?color=orange)](https://www.python.org/dev/peps/pep-0427/)


A Pythonic client for the official [data.gov.gr](https://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`:

```bash
pip install pydatagovgr
```

## Quick Usage

```python
from pydatagovgr import DataGovClient


gov = DataGovClient()

# fetch public administration evaluation data
evaluation_data = gov.query('public-administration-evaluation')

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

# fetch data on Greece's internet traffic
traffic_data = gov.query('internet_traffic', date_from='2025-06-15', date_to='2025-07-18')

# fetch a list of the forest fires
fire_data = gov.query('mcp_forest_fires', date_from='2017-01-01', date_to='2018-12-31')
```

## Features

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

- **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.
- Some endpoint have required params while others do not.
- If you want to directly download the results as JSON or CSV, add the keyword `download/` before the dataset name e.g. `download/mdg_emvolio` and pass the param `type='json'` or `type='csv'` respectively. 

```python
from pydatagovgr import DataGovClient


gov = DataGovClient()

# fetch the sailing data
sailing_data = gov.query('sailing_traffic', date_from='2025-01-01', date_to='2025-07-18')
```
You can also use Python objects as arguments:

```python
import datetime


data = gov.query(
    'sailing_traffic', 
    date_from=datetime.date(2025, 1, 1),
    date_to=datetime.date(2025, 7, 18)
)
```

```python
# you can also download them as CSV
download = gov.query('download/public-administration-evaluation', type='csv')

decoded_content = download.content.decode('utf-8')

cr = csv.reader(decoded_content.splitlines(), delimiter=',')

dataset = list(cr)
for row in dataset:
  print(row)

# or in JSON
download = gov.query('download/ekt-expenses-source', type='csv')
```

You can also configure the timeout and retry policies of your client. For example: 

```python
# this client will stop waiting for a response after 7 seconds 
gov = DataGovClient(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(max_retries=3)

# this client will respect both a timeout policy and a retry policy
gov = DataGovClient(timeout=7, max_retries=3)
```

## Related Projects

- [go-data-gov-gr-sdk](https://github.com/ppapapetrou76/go-data-gov-gr-sdk): An SDK - written in Go - to access the data.gov.gr API.
- [datagovgR](https://github.com/elenigvasilaki/datagovgR): An R Wrapper Package for the data.gov.gr API.

## How to contribute

If you wish to contribute, [this](CONTRIBUTING.md) is a great place to start!

## License

Distributed under the [MIT License](LICENSE).

## Acknowledgements

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/pydatagovgr",
    "name": "pydatagovgr",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "client, pip, govgr, open-data",
    "author": "ilias-ant",
    "author_email": "ilias.antonopoulos@yahoo.gr",
    "download_url": "https://files.pythonhosted.org/packages/87/40/abee9070800383966e447c64ebbc79b440be5b184a075539beb85a55cc02/pydatagovgr-1.0.1.tar.gz",
    "platform": null,
    "description": "# pydatagovgr\n\n[![PyPI](https://img.shields.io/pypi/v/pydatagovgr?color=blue&label=PyPI&logo=PyPI&logoColor=white)](https://pypi.org/project/pydatagovgr/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pydatagovgr?logo=python&logoColor=white)](https://www.python.org/) [![codecov](https://codecov.io/gh/ilias-ant/pydatagovgr/branch/main/graph/badge.svg?token=2H0VB8I8IH)](https://codecov.io/gh/ilias-ant/pydatagovgr) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ilias-ant/pydatagovgr/ci.yml?branch=main)](https://github.com/ilias-ant/pydatagovgr/actions/workflows/ci.yml) [![Documentation Status](https://readthedocs.org/projects/pydatagovgr/badge/?version=latest)](https://pydatagovgr.readthedocs.io/en/latest/?badge=latest)\n [![PyPI - Wheel](https://img.shields.io/pypi/wheel/pydatagovgr?color=orange)](https://www.python.org/dev/peps/pep-0427/)\n\n\nA Pythonic client for the official [data.gov.gr](https://data.gov.gr) API. Aims to be an easy, intuitive and \nout-of-the-box way to:\n\n- find data published by central government, local authorities and public bodies of Greece\n- build related products and services.\n\nwhile being robust, following best-practices and eliminating developer-induced bugs.\n\nThe aspiration for this library is to enable users of different backgrounds (academia, industry, students etc.) with \nan interest to programmatically explore and utilize the open data of data.gov.gr, to do so without having to \nwrite-debug-maintain trivial code or worry about that.\n\n## Install\n\nThe recommended installation is via `pip`:\n\n```bash\npip install pydatagovgr\n```\n\n## Quick Usage\n\n```python\nfrom pydatagovgr import DataGovClient\n\n\ngov = DataGovClient()\n\n# fetch public administration evaluation data\nevaluation_data = gov.query('public-administration-evaluation')\n\n# fetch the COVID-19 vaccination data\ncovid_data = gov.query('mdg_emvolio', date_from='2021-10-01', date_to='2021-12-31')\n\n# fetch data on Greece's internet traffic\ntraffic_data = gov.query('internet_traffic', date_from='2025-06-15', date_to='2025-07-18')\n\n# fetch a list of the forest fires\nfire_data = gov.query('mcp_forest_fires', date_from='2017-01-01', date_to='2018-12-31')\n```\n\n## Features\n\nThe `pydatagovgr` client supports out-of-the-box all the things you know (and love), such as:\n\n- **persistent session**: making several requests to data.gov.gr reuses the same underlying connection.\n- **timeout policy**: informs data.gov.gr that it will await at most x seconds for a response for a given request. \n  Defaults to 60 sec.\n- **retry policy**: to account for potential server failures of lossy network connections, client automatically retries\n  with an exponential-backoff, to avoid harming the data.gov.gr. Defaults to a maximum of 3 retries.\n\n## Not-So-Quick Usage\n\nThe data.gov.gr API exposes, through its `api/v1/query` GET endpoint, various **datasets** from different topics.\n\nThe `pydatagovgr` client thus provides a corresponding `query` method, through which every available dataset can be obtained. \n\n- You can also pass additional arguments to filter the results accordingly.\n- Some endpoint have required params while others do not.\n- If you want to directly download the results as JSON or CSV, add the keyword `download/` before the dataset name e.g. `download/mdg_emvolio` and pass the param `type='json'` or `type='csv'` respectively. \n\n```python\nfrom pydatagovgr import DataGovClient\n\n\ngov = DataGovClient()\n\n# fetch the sailing data\nsailing_data = gov.query('sailing_traffic', date_from='2025-01-01', date_to='2025-07-18')\n```\nYou can also use Python objects as arguments:\n\n```python\nimport datetime\n\n\ndata = gov.query(\n    'sailing_traffic', \n    date_from=datetime.date(2025, 1, 1),\n    date_to=datetime.date(2025, 7, 18)\n)\n```\n\n```python\n# you can also download them as CSV\ndownload = gov.query('download/public-administration-evaluation', type='csv')\n\ndecoded_content = download.content.decode('utf-8')\n\ncr = csv.reader(decoded_content.splitlines(), delimiter=',')\n\ndataset = list(cr)\nfor row in dataset:\n  print(row)\n\n# or in JSON\ndownload = gov.query('download/ekt-expenses-source', type='csv')\n```\n\nYou can also configure the timeout and retry policies of your client. For example: \n\n```python\n# this client will stop waiting for a response after 7 seconds \ngov = DataGovClient(timeout=7)\n\n# this client will retry at most 3 times, with an exponential-backoff\n# (i.e. each retry waits exponentially longer before occurs: 1, 2, 4, 8, ...sec)\ngov = DataGovClient(max_retries=3)\n\n# this client will respect both a timeout policy and a retry policy\ngov = DataGovClient(timeout=7, max_retries=3)\n```\n\n## Related Projects\n\n- [go-data-gov-gr-sdk](https://github.com/ppapapetrou76/go-data-gov-gr-sdk): An SDK - written in Go - to access the data.gov.gr API.\n- [datagovgR](https://github.com/elenigvasilaki/datagovgR): An R Wrapper Package for the data.gov.gr API.\n\n## How to contribute\n\nIf you wish to contribute, [this](CONTRIBUTING.md) is a great place to start!\n\n## License\n\nDistributed under the [MIT License](LICENSE).\n\n## Acknowledgements\n\nAll rights are reserved by the official [https://data.gov.gr](https://data.gov.gr) site, its developers, its maintainers and the \nHellenic Government.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Pythonic client for the official https://data.gov.gr API.",
    "version": "1.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/ilias-ant/pydatagovgr/issues",
        "Documentation": "https://pydatagovgr.readthedocs.io",
        "Homepage": "https://pypi.org/project/pydatagovgr",
        "Repository": "https://github.com/ilias-ant/pydatagovgr"
    },
    "split_keywords": [
        "client",
        " pip",
        " govgr",
        " open-data"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e346c09f56d55094bf61388bacd7041f5d53a4a1539e032d6ebb40d95a738562",
                "md5": "91155fb795b574ae714a154fb7e5928c",
                "sha256": "30ca4094d0f8e6b743ef9066d27bb07c62cc417454f7af6a743cc9a6d072fbcb"
            },
            "downloads": -1,
            "filename": "pydatagovgr-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "91155fb795b574ae714a154fb7e5928c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 8098,
            "upload_time": "2025-07-25T14:53:46",
            "upload_time_iso_8601": "2025-07-25T14:53:46.434849Z",
            "url": "https://files.pythonhosted.org/packages/e3/46/c09f56d55094bf61388bacd7041f5d53a4a1539e032d6ebb40d95a738562/pydatagovgr-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8740abee9070800383966e447c64ebbc79b440be5b184a075539beb85a55cc02",
                "md5": "2a908fde1f5e935f0e21fd4e5cd946dc",
                "sha256": "a8958f9638c8a79dd13563497894e7c34d52d7839f90ff3166a2bb818853c24f"
            },
            "downloads": -1,
            "filename": "pydatagovgr-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2a908fde1f5e935f0e21fd4e5cd946dc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 6389,
            "upload_time": "2025-07-25T14:53:48",
            "upload_time_iso_8601": "2025-07-25T14:53:48.894631Z",
            "url": "https://files.pythonhosted.org/packages/87/40/abee9070800383966e447c64ebbc79b440be5b184a075539beb85a55cc02/pydatagovgr-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-25 14:53:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ilias-ant",
    "github_project": "pydatagovgr",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "pydatagovgr"
}
        
Elapsed time: 1.69722s