{"id":20576474,"url":"https://github.com/hazarddede/ferien-api","last_synced_at":"2025-04-14T18:22:22.085Z","repository":{"id":57429087,"uuid":"172009213","full_name":"HazardDede/ferien-api","owner":"HazardDede","description":"Python client library for ferien-api.de","archived":false,"fork":false,"pushed_at":"2022-10-07T16:18:34.000Z","size":57,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T06:51:09.643Z","etag":null,"topics":["api","async","client","ferien","ferien-api","german","germany","vacations"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HazardDede.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-22T06:44:42.000Z","updated_at":"2024-01-27T15:21:12.000Z","dependencies_parsed_at":"2022-09-08T23:41:05.596Z","dependency_job_id":null,"html_url":"https://github.com/HazardDede/ferien-api","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HazardDede%2Fferien-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HazardDede%2Fferien-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HazardDede%2Fferien-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HazardDede%2Fferien-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HazardDede","download_url":"https://codeload.github.com/HazardDede/ferien-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248933568,"owners_count":21185504,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","async","client","ferien","ferien-api","german","germany","vacations"],"created_at":"2024-11-16T05:45:55.209Z","updated_at":"2025-04-14T18:22:22.026Z","avatar_url":"https://github.com/HazardDede.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ferien-api\n\n[![PyPI version](https://badge.fury.io/py/ferien-api.svg)](https://badge.fury.io/py/ferien-api)\n[![Build Status](https://travis-ci.org/HazardDede/ferien-api.svg?branch=master)](https://travis-ci.org/HazardDede/ferien-api)\n[![Coverage Status](https://coveralls.io/repos/github/HazardDede/ferien-api/badge.svg?branch=master)](https://coveralls.io/github/HazardDede/ferien-api?branch=master)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\u003e Python client library for ferien-api.de\n\n## Installation\n\n`ferien-api` needs python 3.5+ to function properly\n\n```\npip install ferien-api\n```\n\n## Usage\n\nYou could use the synchronous implementation which will block until a response arrives from the api\nor you could use the async implementation which will be non-blocking your other async stuff.\n\n**Synchronous**:\n\n```python\nimport ferien\n\n\ndef main():\n    # Get all vacations for all time and states\n    print(\"All vacations:\", ferien.all_vacations())\n\n    # Get all vacations for a specific state (in this case Hamburg - HH) ...\n    print(\"All vacations for HH:\", ferien.state_vacations('HH'))\n\n    # ... and optionally for a specific year\n    print(\"All vacations for HH in 2019:\", ferien.state_vacations('HH', 2019))\n\n    # Fetch all valid states\n    print(\"Valid state codes:\", ferien.state_codes())\n\n    # Get current vacation (None if there is no vacation)\n    print(\"Current vacation in HH:\", ferien.current_vacation('HH'))\n\n    # Get next vacation (None if there is no next vacation)\n    print(\"Next vacation in HH:\", ferien.next_vacation('HH'))\n\n\nif __name__ == '__main__':\n    main()\n\n```\n\n**Asynchronous**:\n\n```python\nimport asyncio\n\nimport ferien\n\n\nasync def main():\n    # Get all vacations for all time and states\n    print(\"All vacations:\", await ferien.all_vacations_async())\n\n    # Get all vacations for a specific state (in this case Hamburg - HH) ...\n    print(\"All vacations for HH:\", await ferien.state_vacations_async('HH'))\n\n    # ... and optionally for a specific year\n    print(\"All vacations for HH in 2019:\", await ferien.state_vacations_async('HH', 2019))\n\n    # Fetch all valid states. This one is _NOT_ async\n    print(\"Valid state codes:\", ferien.state_codes())\n\n    # Get current vacation (None if there is no vacation)\n    print(\"Current vacation in HH:\", ferien.current_vacation(vacs=await ferien.state_vacations_async('HH')))\n\n    # Get next vacation (None if there is no next vacation)\n    print(\"Next vacation in HH:\", ferien.next_vacation(vacs=await ferien.state_vacations_async('HH')))\n\n\nif __name__ == '__main__':\n    loop = asyncio.get_event_loop()\n    loop.run_until_complete(main())\n\n```\n\nBoth implementations of `all_vacations` and `state_vacations` will return a list of `Vacation` data objects.\nSee below for the definition of a `Vacation` object.\n\n```python\nVacation(\n    start=datetime.datetime(2020, 12, 21, 0, 0),\n    end=datetime.datetime(2021, 1, 5, 0, 0),\n    year=2020,\n    state_code='HH',\n    name='weihnachtsferien',\n    slug='weihnachtsferien-2020-HH'\n)\n```\n\n*Please note*: All datetime objects are in the `Europe/Berlin (CET/CEST)` timezone\n\nUsing the async version it is easy to make multiple requests in \"parallel\" (not true... you know that when you are\nan asyncio enthusiast) and save a lot of time:\n\n```python\nimport asyncio\n\nimport ferien\n\n\nasync def print_wrapper(state_code):\n    print(\"Fetching {}\".format(state_code))\n    res = await ferien.state_vacations_async(state_code, 2019)\n    print(\"Fetched {}\".format(state_code))\n    return res\n\n\nif __name__ == '__main__':\n    loop = asyncio.get_event_loop()\n    coros = [\n        print_wrapper('HH'),\n        print_wrapper('SH'),\n        print_wrapper('BE'),\n        print_wrapper('BB')\n    ]\n    loop.run_until_complete(asyncio.gather(*coros))\n\n```\n\n## Changelog\n\n**0.3.7**\n* Adapts the vacation date parsing logic to the new ferien-api standard (#8)\n* Fixes some linting errors using the latest linter / mypy (#8)\n\n**0.3.6**\n* Removes unnecessary print statement in utils.py\n\n**0.3.5**\n* Adds strptime fallback for Z remainder (#5)\n\n**0.3.4**\n* Fixes incorrect localization to Europe/Berlin for dates\n\n**0.3.3**\n* Changes all timestamps from naive to 'Europe/Berlin'\n\n**0.3.2**\n* Adds type hints to codebase\n* Adds mypy as a linter\n\n**0.3.1**\n* Adds pylint as a linter and make him happy!\n\n**0.3.0**\n* Adds `current_vacation` and `next_vacation` implementations\n\n**0.2.0**\n* Adds an async implementation of `all_vacations` and `state_vacations`\n\n**0.1.0**\n* Initial version","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazarddede%2Fferien-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhazarddede%2Fferien-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazarddede%2Fferien-api/lists"}