├── .github └── workflows │ ├── deutschland_generator.yml │ ├── openapi_check.yaml │ ├── pages.yml │ └── schemathesis.yaml ├── CNAME ├── README.md ├── README_en.md ├── generator_config.yaml ├── index.html ├── openapi.yaml ├── openapi_en.yaml └── python-client ├── .openapi-generator-ignore ├── .openapi-generator ├── FILES └── VERSION ├── README.md ├── deutschland └── feiertage │ ├── __init__.py │ ├── api │ ├── __init__.py │ └── default_api.py │ ├── api_client.py │ ├── apis │ └── __init__.py │ ├── configuration.py │ ├── exceptions.py │ ├── model │ ├── __init__.py │ └── feiertag.py │ ├── model_utils.py │ ├── models │ └── __init__.py │ └── rest.py ├── docs ├── DefaultApi.md └── Feiertag.md ├── pyproject.toml ├── requirements.txt ├── sphinx-docs ├── Makefile ├── conf.py ├── index.rst ├── make.bat └── source │ ├── feiertage.api.rst │ ├── feiertage.apis.rst │ ├── feiertage.model.rst │ ├── feiertage.models.rst │ ├── feiertage.rst │ └── modules.rst ├── test-requirements.txt ├── test ├── __init__.py ├── test_default_api.py └── test_feiertag.py └── tox.ini /.github/workflows/deutschland_generator.yml: -------------------------------------------------------------------------------- 1 | on: [push] 2 | jobs: 3 | deutschland_generation: 4 | name: "Deutschland Generation" 5 | runs-on: ubuntu-latest 6 | strategy: 7 | fail-fast: false 8 | matrix: 9 | python-version: ['3.11.1' ] 10 | steps: 11 | - uses: actions/checkout@v2 12 | 13 | # Create default .spectral.yaml file used for linting if its not existing already 14 | - name: "Create spectral file if it not exists" 15 | continue-on-error: true 16 | run: | 17 | set -C; echo "extends: spectral:oas" > .spectral.yaml 18 | # Runs a single command using the runners shell 19 | - name: "Lint file" 20 | uses: stoplightio/spectral-action@latest 21 | with: 22 | file_glob: "openapi.yaml" 23 | 24 | - name: "Generate deutschland code" 25 | uses: wirthual/deutschland-generator-action@latest 26 | with: 27 | openapi-file: ${{ github.workspace }}/openapi.yaml 28 | commit-to-git: true 29 | upload-to-pypi: true 30 | upload-to-testpypi: false 31 | pypi-token: ${{ secrets.PYPI_PRODUCTION }} 32 | testpypi-token: ${{ secrets.PYPI_TEST }} 33 | python-version: ${{ matrix.python-version }} 34 | -------------------------------------------------------------------------------- /.github/workflows/openapi_check.yaml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | jobs: 3 | openapi_check: 4 | name: "OpenAPI check" 5 | runs-on: ubuntu-latest 6 | steps: 7 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 8 | - uses: actions/checkout@v2 9 | 10 | # Create default .spectral.yaml file used for linting if its not existing already 11 | - name: "Create spectral file if it not exists" 12 | continue-on-error: true 13 | run: | 14 | set -C; echo "extends: spectral:oas" > .spectral.yaml 15 | 16 | # Run Spectral 17 | - uses: stoplightio/spectral-action@latest 18 | with: 19 | file_glob: openapi.yaml 20 | spectral_ruleset: .spectral.yaml 21 | -------------------------------------------------------------------------------- /.github/workflows/pages.yml: -------------------------------------------------------------------------------- 1 | # Sample workflow for building and deploying a Jekyll site to GitHub Pages 2 | name: Deploy Jekyll with GitHub Pages dependencies preinstalled 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: ["main"] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow one concurrent deployment 19 | concurrency: 20 | group: "pages" 21 | cancel-in-progress: true 22 | 23 | jobs: 24 | # Build job 25 | build: 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Checkout 29 | uses: actions/checkout@v3 30 | - name: Setup Pages 31 | uses: actions/configure-pages@v1 32 | - name: Build with Jekyll 33 | uses: actions/jekyll-build-pages@v1 34 | with: 35 | source: ./ 36 | destination: ./_site 37 | - name: Upload artifact 38 | uses: actions/upload-pages-artifact@v1 39 | 40 | # Deployment job 41 | deploy: 42 | environment: 43 | name: github-pages 44 | url: ${{ steps.deployment.outputs.page_url }} 45 | runs-on: ubuntu-latest 46 | needs: build 47 | steps: 48 | - name: Deploy to GitHub Pages 49 | id: deployment 50 | uses: actions/deploy-pages@v1 51 | -------------------------------------------------------------------------------- /.github/workflows/schemathesis.yaml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | jobs: 3 | schemathesis: 4 | name: "Perform schemathesis checks" 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - uses: actions/setup-python@v4 9 | with: 10 | python-version: '3.8' 11 | 12 | - run: pip install schemathesis 13 | 14 | - name: "Extract base url from openapi.yaml" 15 | uses: mikefarah/yq@master 16 | with: 17 | cmd: echo "base_url=$(yq -r .servers[].url openapi.yaml)" >> $GITHUB_ENV 18 | 19 | - run: schemathesis run ./openapi.yaml --base-url "${{ env.base_url }}" --checks all 20 | 21 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | feiertage.api.bund.dev -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [[DE]](README.md)/[[EN]](README_en.md) 2 | 3 | # Feiertage API 4 | 5 | Der [Feiertage Webservice](https://feiertage-api.de/) von [Julian Richter](https://www.paypal.com/donate?token=-JAL84u4LbrgiDzVqvJqWOnqhusn30r_FwEBT65n0kqlZd7FTRidVBPL9kjFsKIOsZaqFTEm0jz6_JVm) bietet den Zugriff auf deutsche Feiertage im JSON-Format. 6 | 7 | Das Tool basiert auf den Angaben von http://de.wikipedia.org/wiki/Feiertage_in_Deutschland. Auf der Wikipedia-Seite ist ersichtlich, dass manche Feiertage nicht im ganzen Bundesgebiet, sondern auf Bundeslandebene gelten. Die dort genannten Informationen sind im Tool hinterlegt. 8 | 9 | Ebenso kann es spezielle Anmerkungen zu bestimmten Feiertagen geben (siehe Wikipedia-Seite). Auch diese Hinweise sind im Tool enthalten. 10 | 11 | *Hinweis:* Für die Nutzung des Webservices mittels PHP haben die Ersteller eine Beispiel-Connector-Classe bereitgestellt, die jeder benutzen kann. Sie findet sich [hier](https://feiertage-api.de/api/Connector.php.txt). 12 | 13 | 14 | ## Anfragen 15 | 16 | Die Nutzung des Webservices erfolgt durch einen GET-request an folgende URL: 17 | 18 | **URL:** https://feiertage-api.de/api/ 19 | 20 | Alle Parameter sind einfache GET-Parameter, die der URL angehängt werden. 21 | 22 | 23 | ### Filter 24 | 25 | 26 | **Parameter:** *jahr* 27 | 28 | Pflichtparameter, der ein beliebiges Jahr in Zahlenform annehmen kann, z.B. 2014. 29 | 30 | 31 | **Parameter:** *nur_land* 32 | 33 | Wenn gesetzt, dann werden nur Feiertage des gewählten Bundeslandes angezeigt. 34 | Mögliche Werte: 35 | 36 | - NATIONAL 37 | - BW 38 | - BY 39 | - BE 40 | - BB 41 | - HB 42 | - HH 43 | - HE 44 | - MV 45 | - NI 46 | - NW 47 | - RP 48 | - SL 49 | - SN 50 | - ST 51 | - SH 52 | - TH 53 | 54 | NATIONAL=Bundesweit anerkannte Feiertage, BW=Baden-Württemberg, BY=Bayern, BE=Berlin, BB=Brandenburg, HB=Bremen, HH=Hamburg, HE=Hessen, MV=Mecklenburg-Vorpommern, NI=Niedersachsen, NW=Nordrhei-Westfalen, RP=Rheinland-Pfalz, SL=Saarland, SN=Sachsen, ST=Sachsen-Anhalt, SH=Schleswig-Holstein, TH=Thüringen. 55 | 56 | 57 | **Parameter:** *nur_daten* 58 | 59 | Wenn gesetzt (Wert egal, z.B. auf 1), dann werden keine bundeslandspezifischen informationen ausgegeben, sondern alle deutschen Feiertage samt Datum ausgegeben. 60 | 61 | 62 | **Parameter:** *callback* 63 | 64 | Wenn gesetzt, dann wird die Ausgabe in eine JSONP-Funktion eingebettet. 65 | 66 | 67 | ### Beispiel 68 | 69 | ```bash 70 | feiertage=$(curl -m 60 'https://feiertage-api.de/api/?jahr=2022&nur_land=BY') 71 | ``` 72 | -------------------------------------------------------------------------------- /README_en.md: -------------------------------------------------------------------------------- 1 | [[DE]](README.md)/[[EN]](README_en.md) 2 | 3 | # Holidays API 4 | 5 | The [Holidays Web Service](https://feiertage api.de/) of [Julian Richter](https://www.paypal.com/donate?token=-JAL84u4LbrgiDzVqvJqWOnqhusn30r_FwEBT65n0kqlZd7FTRidVBPL9kjFsKIOsZaqFTEm0jz6_JVm) provides access to German holidays in JSON format. 6 | 7 | The tool is based on the information provided by http://de.wikipedia.org/wiki/Feiertage_in_Deutschland. On the Wikipedia page it can be seen that some holidays do not apply throughout Germany, but at the state level. The information mentioned there is integrated in the tool. 8 | 9 | There may also be special comments on certain holidays (see Wikipedia page). These comments are also included in the tool. 10 | 11 | *Note:* For the use of the web service using PHP, the creators have provided a sample connector class that anyone can use. It can be found [here](https://feiertage-api.de/api/Connector.php.txt). 12 | 13 | 14 | ## Requests 15 | 16 | Applying the web service requires a GET-request to the following URL: 17 | 18 | **URL:** https://feiertage-api.de/api/ 19 | 20 | All parameters are simple GET parameters that are appended to the URL. 21 | 22 | 23 | ### Filter 24 | 25 | 26 | **Parameter:** *jahr* 27 | 28 | Mandatory parameter that can take any year in numerical form, e.g. 2014 29 | 30 | 31 | **Parameter:** *nur_land* 32 | 33 | If set, only holidays of the selected state are displayed. 34 | Possible values: 35 | 36 | - NATIONAL 37 | - BW 38 | - BY 39 | - BE 40 | - BB 41 | - HB 42 | - HH 43 | - HE 44 | - MV 45 | - NI 46 | - NW 47 | - RP 48 | - SL 49 | - SN 50 | - ST 51 | - SH 52 | - TH 53 | 54 | NATIONAL=Nationally recognized holidays, BW=Baden-Württemberg, BY=Bayern, BE=Berlin, BB=Brandenburg, HB=Bremen, HH=Hamburg, HE=Hessen, MV=Mecklenburg-Vorpommern, NI=Niedersachsen, NW=Nordrhei-Westfalen, RP=Rheinland-Pfalz, SL=Saarland, SN=Sachsen, ST=Sachsen-Anhalt, SH=Schleswig-Holstein, TH=Thüringen. 55 | 56 | 57 | **Parameter:** *nur_daten* 58 | 59 | If set (value does not matter, e.g. to 1), then no state-specific information is returned. Instead, all German holidays as well as their date are returned. 60 | 61 | 62 | **Parameter:** *callback* 63 | 64 | If set, then the output is embedded in a JSONP function. 65 | 66 | 67 | ### Example 68 | 69 | ```bash 70 | holidays=$(curl -m 60 'https://feiertage-api.de/api/?jahr=2022&nur_land=BY') 71 | ``` 72 | 73 | -------------------------------------------------------------------------------- /generator_config.yaml: -------------------------------------------------------------------------------- 1 | templateDir: deutschland_templates # For local use: ./local/deutschland_templates 2 | additionalProperties: 3 | packageName: "feiertage" 4 | infoName: "BundesAPI" 5 | infoEmail: "kontakt@bund.dev" 6 | packageVersion: 1.0.2 7 | packageUrl: "https://github.com/bundesAPI/feiertage-api" 8 | namespace: "deutschland" 9 | docLanguage: "de" 10 | gitHost: "github.com" 11 | gitUserId: "bundesAPI" 12 | gitRepoId: "feiertage-api" 13 | files: 14 | pyproject.mustache: 15 | destinationFilename: pyproject.toml 16 | templateType: SupportingFiles 17 | requirements.txt: {} 18 | create_doc.mustache: 19 | destinationFilename: create_doc.py 20 | templateType: SupportingFiles 21 | rename_generated_code.mustache: 22 | destinationFilename: rename_generated_code.py 23 | templateType: SupportingFiles 24 | README.mustache: 25 | destinationFilename: README.md 26 | templateType: SupportingFiles 27 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Feiertage - OpenAPI Documentation 8 | 9 | 10 |
[DE]/[EN]
11 | 12 |
13 | 14 | 15 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /openapi.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.0" 2 | info: 3 | title: "Feiertage API" 4 | version: "1.0.0" 5 | description: "Deutsche Feiertage per JSON-Webservice (API) " 6 | contact: 7 | name: "bund.dev" 8 | email: "kontakt@bund.dev" 9 | url: "https://bund.dev" 10 | 11 | servers: 12 | - url: https://feiertage-api.de/api/ 13 | paths: 14 | /: 15 | get: 16 | summary: Get Feiertage 17 | operationId: getFeiertage 18 | parameters: 19 | - name: jahr 20 | in: query 21 | description: Welches Jahr? 22 | schema: 23 | type: string 24 | description: Creation date 25 | example: "2021" 26 | - name: nur_land 27 | in: query 28 | description: Welches Bundesland? 29 | required: false 30 | schema: 31 | type: string 32 | enum: 33 | - NATIONAL 34 | - BW 35 | - BY 36 | - BE 37 | - BB 38 | - HB 39 | - HH 40 | - HE 41 | - MV 42 | - NI 43 | - NW 44 | - RP 45 | - SL 46 | - SN 47 | - ST 48 | - SH 49 | - TH 50 | - name: nur_daten 51 | in: query 52 | description: Nur Daten oder auch Hinweise? 53 | required: false 54 | schema: 55 | type: integer 56 | responses: 57 | '200': 58 | description: Feiertage 59 | content: 60 | application/json: 61 | schema: 62 | $ref: "#/components/schemas/Feiertage" 63 | default: 64 | description: unexpected error 65 | content: 66 | application/json: 67 | schema: 68 | $ref: "#/components/schemas/Error" 69 | 70 | components: 71 | schemas: 72 | Feiertag: 73 | type: object 74 | required: 75 | - datum 76 | properties: 77 | datum: 78 | type: string 79 | hinweis: 80 | type: string 81 | Feiertage: 82 | type: object 83 | example: 84 | Neujahrstag: '2021-01-01' 85 | Heilige Drei Könige: '2021-01-06' 86 | Frauentag: '2021-03-08' 87 | Gründonnerstag: '2021-04-01' 88 | Karfreitag: '2021-04-02' 89 | Ostersonntag: '2021-04-04' 90 | Ostermontag: '2021-04-05' 91 | Tag der Arbeit: '2021-05-01' 92 | Christi Himmelfahrt: '2021-05-13' 93 | Pfingstsonntag: '2021-05-23' 94 | Pfingstmontag: '2021-05-24' 95 | Fronleichnam: '2021-06-03' 96 | Augsburger Friedensfest: '2021-08-08' 97 | Mariä Himmelfahrt: '2021-08-15' 98 | Weltkindertag: '2021-09-20' 99 | Tag der Deutschen Einheit: '2021-10-03' 100 | Reformationstag: '2021-10-31' 101 | Allerheiligen: '2021-11-01' 102 | Buß- und Bettag: '2021-11-17' 103 | 1. Weihnachtstag: '2021-12-25' 104 | 2. Weihnachtstag: '2021-12-26' 105 | 106 | Error: 107 | type: object 108 | -------------------------------------------------------------------------------- /openapi_en.yaml: -------------------------------------------------------------------------------- 1 | openapi: "3.0.0" 2 | info: 3 | title: "Feiertage API" 4 | version: "1.0.0" 5 | description: "German Holidays per JSON-Webservice (API) " 6 | contact: 7 | name: "bund.dev" 8 | email: "kontakt@bund.dev" 9 | url: "https://bund.dev" 10 | 11 | servers: 12 | - url: https://feiertage-api.de/api/ 13 | paths: 14 | /: 15 | get: 16 | summary: Get Feiertage 17 | operationId: getFeiertage 18 | parameters: 19 | - name: jahr 20 | in: query 21 | description: Which year? 22 | schema: 23 | type: string 24 | description: Creation date 25 | example: "2021" 26 | - name: nur_land 27 | in: query 28 | description: Which state? 29 | required: false 30 | schema: 31 | type: string 32 | enum: 33 | - NATIONAL 34 | - BW 35 | - BY 36 | - BE 37 | - BB 38 | - HB 39 | - HH 40 | - HE 41 | - MV 42 | - NI 43 | - NW 44 | - RP 45 | - SL 46 | - SN 47 | - ST 48 | - SH 49 | - TH 50 | - name: nur_daten 51 | in: query 52 | description: Only data or also hints? 53 | required: false 54 | schema: 55 | type: integer 56 | responses: 57 | '200': 58 | description: Feiertage 59 | content: 60 | application/json: 61 | schema: 62 | $ref: "#/components/schemas/Feiertage" 63 | default: 64 | description: unexpected error 65 | content: 66 | application/json: 67 | schema: 68 | $ref: "#/components/schemas/Error" 69 | 70 | components: 71 | schemas: 72 | Feiertag: 73 | type: object 74 | required: 75 | - datum 76 | properties: 77 | datum: 78 | type: string 79 | hinweis: 80 | type: string 81 | Feiertage: 82 | type: object 83 | example: 84 | Neujahrstag: '2021-01-01' 85 | Heilige Drei Könige: '2021-01-06' 86 | Frauentag: '2021-03-08' 87 | Gründonnerstag: '2021-04-01' 88 | Karfreitag: '2021-04-02' 89 | Ostersonntag: '2021-04-04' 90 | Ostermontag: '2021-04-05' 91 | Tag der Arbeit: '2021-05-01' 92 | Christi Himmelfahrt: '2021-05-13' 93 | Pfingstsonntag: '2021-05-23' 94 | Pfingstmontag: '2021-05-24' 95 | Fronleichnam: '2021-06-03' 96 | Augsburger Friedensfest: '2021-08-08' 97 | Mariä Himmelfahrt: '2021-08-15' 98 | Weltkindertag: '2021-09-20' 99 | Tag der Deutschen Einheit: '2021-10-03' 100 | Reformationstag: '2021-10-31' 101 | Allerheiligen: '2021-11-01' 102 | Buß- und Bettag: '2021-11-17' 103 | 1. Weihnachtstag: '2021-12-25' 104 | 2. Weihnachtstag: '2021-12-26' 105 | 106 | Error: 107 | type: object 108 | -------------------------------------------------------------------------------- /python-client/.openapi-generator-ignore: -------------------------------------------------------------------------------- 1 | # OpenAPI Generator Ignore 2 | # Generated by openapi-generator https://github.com/openapitools/openapi-generator 3 | 4 | # Use this file to prevent files from being overwritten by the generator. 5 | # The patterns follow closely to .gitignore or .dockerignore. 6 | 7 | # As an example, the C# client generator defines ApiClient.cs. 8 | # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: 9 | #ApiClient.cs 10 | 11 | # You can match any string of characters against a directory, file or extension with a single asterisk (*): 12 | #foo/*/qux 13 | # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux 14 | 15 | # You can recursively match patterns against a directory, file or extension with a double asterisk (**): 16 | #foo/**/qux 17 | # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux 18 | 19 | # You can also negate patterns with an exclamation (!). 20 | # For example, you can ignore all files in a docs folder with the file extension .md: 21 | #docs/*.md 22 | # Then explicitly reverse the ignore rule for a single file: 23 | #!docs/README.md 24 | -------------------------------------------------------------------------------- /python-client/.openapi-generator/FILES: -------------------------------------------------------------------------------- 1 | .gitignore 2 | .gitlab-ci.yml 3 | .openapi-generator-ignore 4 | .travis.yml 5 | README.md 6 | create_doc.py 7 | docs/DefaultApi.md 8 | docs/Feiertag.md 9 | feiertage/__init__.py 10 | feiertage/api/__init__.py 11 | feiertage/api/default_api.py 12 | feiertage/api_client.py 13 | feiertage/apis/__init__.py 14 | feiertage/configuration.py 15 | feiertage/exceptions.py 16 | feiertage/model/__init__.py 17 | feiertage/model/feiertag.py 18 | feiertage/model_utils.py 19 | feiertage/models/__init__.py 20 | feiertage/rest.py 21 | git_push.sh 22 | pyproject.toml 23 | rename_generated_code.py 24 | requirements.txt 25 | requirements.txt 26 | setup.cfg 27 | setup.py 28 | test-requirements.txt 29 | test/__init__.py 30 | test/test_default_api.py 31 | test/test_feiertag.py 32 | tox.ini 33 | -------------------------------------------------------------------------------- /python-client/.openapi-generator/VERSION: -------------------------------------------------------------------------------- 1 | 6.1.0 -------------------------------------------------------------------------------- /python-client/README.md: -------------------------------------------------------------------------------- 1 | # feiertage 2 | Deutsche Feiertage per JSON-Webservice (API) 3 | 4 | This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: 5 | 6 | - API version: 1.0.0 7 | - Package version: 1.0.2 8 | - Build package: org.openapitools.codegen.languages.PythonClientCodegen 9 | For more information, please visit [https://bund.dev](https://bund.dev) 10 | 11 | ## Requirements. 12 | 13 | Python >= 3.6 14 | 15 | ## Installation & Usage 16 | ### pip install 17 | 18 | ```sh 19 | pip install deutschland[feiertage] 20 | ``` 21 | 22 | ### poetry install 23 | 24 | ```sh 25 | poetry add deutschland -E feiertage 26 | ``` 27 | 28 | ### Setuptools 29 | 30 | Install via [Setuptools](http://pypi.python.org/pypi/setuptools). 31 | 32 | ```sh 33 | python setup.py install --user 34 | ``` 35 | (or `sudo python setup.py install` to install the package for all users) 36 | 37 | ## Usage 38 | 39 | Import the package: 40 | ```python 41 | from deutschland import feiertage 42 | ``` 43 | 44 | ## Getting Started 45 | 46 | Please follow the [installation procedure](#installation--usage) and then run the following: 47 | 48 | ```python 49 | 50 | import time 51 | from deutschland import feiertage 52 | from pprint import pprint 53 | from deutschland.feiertage.api import default_api 54 | # Defining the host is optional and defaults to https://feiertage-api.de/api 55 | # See configuration.py for a list of all supported configuration parameters. 56 | configuration = feiertage.Configuration( 57 | host = "https://feiertage-api.de/api" 58 | ) 59 | 60 | 61 | 62 | # Enter a context with an instance of the API client 63 | with feiertage.ApiClient(configuration) as api_client: 64 | # Create an instance of the API class 65 | api_instance = default_api.DefaultApi(api_client) 66 | jahr = "2021" # str | Welches Jahr? (optional) 67 | nur_land = "NATIONAL" # str | Welches Bundesland? (optional) 68 | nur_daten = 1 # int | Nur Daten oder auch Hinweise? (optional) 69 | 70 | try: 71 | # Get Feiertage 72 | api_response = api_instance.get_feiertage(jahr=jahr, nur_land=nur_land, nur_daten=nur_daten) 73 | pprint(api_response) 74 | except feiertage.ApiException as e: 75 | print("Exception when calling DefaultApi->get_feiertage: %s\n" % e) 76 | ``` 77 | 78 | ## Documentation for API Endpoints 79 | 80 | All URIs are relative to *https://feiertage-api.de/api* 81 | 82 | Class | Method | HTTP request | Description 83 | ------------ | ------------- | ------------- | ------------- 84 | *DefaultApi* | [**get_feiertage**](docs/DefaultApi.md#get_feiertage) | **GET** / | Get Feiertage 85 | 86 | 87 | ## Documentation For Models 88 | 89 | - [Feiertag](docs/Feiertag.md) 90 | 91 | 92 | ## Documentation For Authorization 93 | 94 | All endpoints do not require authorization. 95 | 96 | ## Author 97 | 98 | kontakt@bund.dev 99 | 100 | 101 | ## Notes for Large OpenAPI documents 102 | If the OpenAPI document is large, imports in feiertage.apis and feiertage.models may fail with a 103 | RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions: 104 | 105 | Solution 1: 106 | Use specific imports for apis and models like: 107 | - `from deutschland.feiertage.api.default_api import DefaultApi` 108 | - `from deutschland.feiertage.model.pet import Pet` 109 | 110 | Solution 2: 111 | Before importing the package, adjust the maximum recursion limit as shown below: 112 | ``` 113 | import sys 114 | sys.setrecursionlimit(1500) 115 | from deutschland import feiertage 116 | from deutschland.feiertage.apis import * 117 | from deutschland.feiertage.models import * 118 | ``` 119 | 120 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/__init__.py: -------------------------------------------------------------------------------- 1 | # flake8: noqa 2 | 3 | """ 4 | Feiertage API 5 | 6 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 7 | 8 | The version of the OpenAPI document: 1.0.0 9 | Contact: kontakt@bund.dev 10 | Generated by: https://openapi-generator.tech 11 | """ 12 | 13 | 14 | __version__ = "1.0.2" 15 | 16 | # import ApiClient 17 | from deutschland.feiertage.api_client import ApiClient 18 | 19 | # import Configuration 20 | from deutschland.feiertage.configuration import Configuration 21 | 22 | # import exceptions 23 | from deutschland.feiertage.exceptions import ( 24 | ApiAttributeError, 25 | ApiException, 26 | ApiKeyError, 27 | ApiTypeError, 28 | ApiValueError, 29 | OpenApiException, 30 | ) 31 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/api/__init__.py: -------------------------------------------------------------------------------- 1 | # do not import all apis into this module because that uses a lot of memory and stack frames 2 | # if you need the ability to import all apis from one package, import them with 3 | # from deutschland.feiertage.apis import DefaultApi 4 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/api/default_api.py: -------------------------------------------------------------------------------- 1 | """ 2 | Feiertage API 3 | 4 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 5 | 6 | The version of the OpenAPI document: 1.0.0 7 | Contact: kontakt@bund.dev 8 | Generated by: https://openapi-generator.tech 9 | """ 10 | 11 | import re # noqa: F401 12 | import sys # noqa: F401 13 | 14 | from deutschland.feiertage.api_client import ApiClient 15 | from deutschland.feiertage.api_client import Endpoint as _Endpoint 16 | from deutschland.feiertage.model_utils import ( # noqa: F401 17 | check_allowed_values, 18 | check_validations, 19 | date, 20 | datetime, 21 | file_type, 22 | none_type, 23 | validate_and_convert_types, 24 | ) 25 | 26 | 27 | class DefaultApi(object): 28 | """NOTE: This class is auto generated by OpenAPI Generator 29 | Ref: https://openapi-generator.tech 30 | 31 | Do not edit the class manually. 32 | """ 33 | 34 | def __init__(self, api_client=None): 35 | if api_client is None: 36 | api_client = ApiClient() 37 | self.api_client = api_client 38 | self.get_feiertage_endpoint = _Endpoint( 39 | settings={ 40 | "response_type": ( 41 | { 42 | str: ( 43 | bool, 44 | date, 45 | datetime, 46 | dict, 47 | float, 48 | int, 49 | list, 50 | str, 51 | none_type, 52 | ) 53 | }, 54 | ), 55 | "auth": [], 56 | "endpoint_path": "/", 57 | "operation_id": "get_feiertage", 58 | "http_method": "GET", 59 | "servers": None, 60 | }, 61 | params_map={ 62 | "all": [ 63 | "jahr", 64 | "nur_land", 65 | "nur_daten", 66 | ], 67 | "required": [], 68 | "nullable": [], 69 | "enum": [ 70 | "nur_land", 71 | ], 72 | "validation": [], 73 | }, 74 | root_map={ 75 | "validations": {}, 76 | "allowed_values": { 77 | ("nur_land",): { 78 | "NATIONAL": "NATIONAL", 79 | "BW": "BW", 80 | "BY": "BY", 81 | "BE": "BE", 82 | "BB": "BB", 83 | "HB": "HB", 84 | "HH": "HH", 85 | "HE": "HE", 86 | "MV": "MV", 87 | "NI": "NI", 88 | "NW": "NW", 89 | "RP": "RP", 90 | "SL": "SL", 91 | "SN": "SN", 92 | "ST": "ST", 93 | "SH": "SH", 94 | "TH": "TH", 95 | }, 96 | }, 97 | "openapi_types": { 98 | "jahr": (str,), 99 | "nur_land": (str,), 100 | "nur_daten": (int,), 101 | }, 102 | "attribute_map": { 103 | "jahr": "jahr", 104 | "nur_land": "nur_land", 105 | "nur_daten": "nur_daten", 106 | }, 107 | "location_map": { 108 | "jahr": "query", 109 | "nur_land": "query", 110 | "nur_daten": "query", 111 | }, 112 | "collection_format_map": {}, 113 | }, 114 | headers_map={ 115 | "accept": ["application/json"], 116 | "content_type": [], 117 | }, 118 | api_client=api_client, 119 | ) 120 | 121 | def get_feiertage(self, **kwargs): 122 | """Get Feiertage # noqa: E501 123 | 124 | This method makes a synchronous HTTP request by default. To make an 125 | asynchronous HTTP request, please pass async_req=True 126 | 127 | >>> thread = api.get_feiertage(async_req=True) 128 | >>> result = thread.get() 129 | 130 | 131 | Keyword Args: 132 | jahr (str): Welches Jahr?. [optional] 133 | nur_land (str): Welches Bundesland?. [optional] 134 | nur_daten (int): Nur Daten oder auch Hinweise?. [optional] 135 | _return_http_data_only (bool): response data without head status 136 | code and headers. Default is True. 137 | _preload_content (bool): if False, the urllib3.HTTPResponse object 138 | will be returned without reading/decoding response data. 139 | Default is True. 140 | _request_timeout (int/float/tuple): timeout setting for this request. If 141 | one number provided, it will be total request timeout. It can also 142 | be a pair (tuple) of (connection, read) timeouts. 143 | Default is None. 144 | _check_input_type (bool): specifies if type checking 145 | should be done one the data sent to the server. 146 | Default is True. 147 | _check_return_type (bool): specifies if type checking 148 | should be done one the data received from the server. 149 | Default is True. 150 | _spec_property_naming (bool): True if the variable names in the input data 151 | are serialized names, as specified in the OpenAPI document. 152 | False if the variable names in the input data 153 | are pythonic names, e.g. snake case (default) 154 | _content_type (str/None): force body content-type. 155 | Default is None and content-type will be predicted by allowed 156 | content-types and body. 157 | _host_index (int/None): specifies the index of the server 158 | that we want to use. 159 | Default is read from the configuration. 160 | _request_auths (list): set to override the auth_settings for an a single 161 | request; this effectively ignores the authentication 162 | in the spec for a single request. 163 | Default is None 164 | async_req (bool): execute request asynchronously 165 | 166 | Returns: 167 | {str: (bool, date, datetime, dict, float, int, list, str, none_type)} 168 | If the method is called asynchronously, returns the request 169 | thread. 170 | """ 171 | kwargs["async_req"] = kwargs.get("async_req", False) 172 | kwargs["_return_http_data_only"] = kwargs.get("_return_http_data_only", True) 173 | kwargs["_preload_content"] = kwargs.get("_preload_content", True) 174 | kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) 175 | kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) 176 | kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) 177 | kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) 178 | kwargs["_content_type"] = kwargs.get("_content_type") 179 | kwargs["_host_index"] = kwargs.get("_host_index") 180 | kwargs["_request_auths"] = kwargs.get("_request_auths", None) 181 | return self.get_feiertage_endpoint.call_with_http_info(**kwargs) 182 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/api_client.py: -------------------------------------------------------------------------------- 1 | """ 2 | Feiertage API 3 | 4 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 5 | 6 | The version of the OpenAPI document: 1.0.0 7 | Contact: kontakt@bund.dev 8 | Generated by: https://openapi-generator.tech 9 | """ 10 | 11 | import atexit 12 | import io 13 | import json 14 | import mimetypes 15 | import os 16 | import re 17 | import typing 18 | from multiprocessing.pool import ThreadPool 19 | from urllib.parse import quote 20 | 21 | from deutschland.feiertage import rest 22 | from deutschland.feiertage.configuration import Configuration 23 | from deutschland.feiertage.exceptions import ApiException, ApiTypeError, ApiValueError 24 | from deutschland.feiertage.model_utils import ( 25 | ModelComposed, 26 | ModelNormal, 27 | ModelSimple, 28 | check_allowed_values, 29 | check_validations, 30 | date, 31 | datetime, 32 | deserialize_file, 33 | file_type, 34 | model_to_dict, 35 | none_type, 36 | validate_and_convert_types, 37 | ) 38 | from urllib3.fields import RequestField 39 | 40 | 41 | class ApiClient(object): 42 | """Generic API client for OpenAPI client library builds. 43 | 44 | OpenAPI generic API client. This client handles the client- 45 | server communication, and is invariant across implementations. Specifics of 46 | the methods and models for each application are generated from the OpenAPI 47 | templates. 48 | 49 | NOTE: This class is auto generated by OpenAPI Generator. 50 | Ref: https://openapi-generator.tech 51 | Do not edit the class manually. 52 | 53 | :param configuration: .Configuration object for this client 54 | :param header_name: a header to pass when making calls to the API. 55 | :param header_value: a header value to pass when making calls to 56 | the API. 57 | :param cookie: a cookie to include in the header when making calls 58 | to the API 59 | :param pool_threads: The number of threads to use for async requests 60 | to the API. More threads means more concurrent API requests. 61 | """ 62 | 63 | _pool = None 64 | 65 | def __init__( 66 | self, 67 | configuration=None, 68 | header_name=None, 69 | header_value=None, 70 | cookie=None, 71 | pool_threads=1, 72 | ): 73 | if configuration is None: 74 | configuration = Configuration.get_default_copy() 75 | self.configuration = configuration 76 | self.pool_threads = pool_threads 77 | 78 | self.rest_client = rest.RESTClientObject(configuration) 79 | self.default_headers = {} 80 | if header_name is not None: 81 | self.default_headers[header_name] = header_value 82 | self.cookie = cookie 83 | # Set default User-Agent. 84 | self.user_agent = "OpenAPI-Generator/1.0.2/python" 85 | 86 | def __enter__(self): 87 | return self 88 | 89 | def __exit__(self, exc_type, exc_value, traceback): 90 | self.close() 91 | 92 | def close(self): 93 | if self._pool: 94 | self._pool.close() 95 | self._pool.join() 96 | self._pool = None 97 | if hasattr(atexit, "unregister"): 98 | atexit.unregister(self.close) 99 | 100 | @property 101 | def pool(self): 102 | """Create thread pool on first request 103 | avoids instantiating unused threadpool for blocking clients. 104 | """ 105 | if self._pool is None: 106 | atexit.register(self.close) 107 | self._pool = ThreadPool(self.pool_threads) 108 | return self._pool 109 | 110 | @property 111 | def user_agent(self): 112 | """User agent for this API client""" 113 | return self.default_headers["User-Agent"] 114 | 115 | @user_agent.setter 116 | def user_agent(self, value): 117 | self.default_headers["User-Agent"] = value 118 | 119 | def set_default_header(self, header_name, header_value): 120 | self.default_headers[header_name] = header_value 121 | 122 | def __call_api( 123 | self, 124 | resource_path: str, 125 | method: str, 126 | path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, 127 | query_params: typing.Optional[ 128 | typing.List[typing.Tuple[str, typing.Any]] 129 | ] = None, 130 | header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, 131 | body: typing.Optional[typing.Any] = None, 132 | post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, 133 | files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, 134 | response_type: typing.Optional[typing.Tuple[typing.Any]] = None, 135 | auth_settings: typing.Optional[typing.List[str]] = None, 136 | _return_http_data_only: typing.Optional[bool] = None, 137 | collection_formats: typing.Optional[typing.Dict[str, str]] = None, 138 | _preload_content: bool = True, 139 | _request_timeout: typing.Optional[ 140 | typing.Union[int, float, typing.Tuple] 141 | ] = None, 142 | _host: typing.Optional[str] = None, 143 | _check_type: typing.Optional[bool] = None, 144 | _content_type: typing.Optional[str] = None, 145 | _request_auths: typing.Optional[ 146 | typing.List[typing.Dict[str, typing.Any]] 147 | ] = None, 148 | ): 149 | 150 | config = self.configuration 151 | 152 | # header parameters 153 | header_params = header_params or {} 154 | header_params.update(self.default_headers) 155 | if self.cookie: 156 | header_params["Cookie"] = self.cookie 157 | if header_params: 158 | header_params = self.sanitize_for_serialization(header_params) 159 | header_params = dict( 160 | self.parameters_to_tuples(header_params, collection_formats) 161 | ) 162 | 163 | # path parameters 164 | if path_params: 165 | path_params = self.sanitize_for_serialization(path_params) 166 | path_params = self.parameters_to_tuples(path_params, collection_formats) 167 | for k, v in path_params: 168 | # specified safe chars, encode everything 169 | resource_path = resource_path.replace( 170 | "{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param) 171 | ) 172 | 173 | # query parameters 174 | if query_params: 175 | query_params = self.sanitize_for_serialization(query_params) 176 | query_params = self.parameters_to_tuples(query_params, collection_formats) 177 | 178 | # post parameters 179 | if post_params or files: 180 | post_params = post_params if post_params else [] 181 | post_params = self.sanitize_for_serialization(post_params) 182 | post_params = self.parameters_to_tuples(post_params, collection_formats) 183 | post_params.extend(self.files_parameters(files)) 184 | if header_params["Content-Type"].startswith("multipart"): 185 | post_params = self.parameters_to_multipart(post_params, (dict)) 186 | 187 | # body 188 | if body: 189 | body = self.sanitize_for_serialization(body) 190 | 191 | # auth setting 192 | self.update_params_for_auth( 193 | header_params, 194 | query_params, 195 | auth_settings, 196 | resource_path, 197 | method, 198 | body, 199 | request_auths=_request_auths, 200 | ) 201 | 202 | # request url 203 | if _host is None: 204 | url = self.configuration.host + resource_path 205 | else: 206 | # use server/host defined in path or operation instead 207 | url = _host + resource_path 208 | 209 | try: 210 | # perform request and return response 211 | response_data = self.request( 212 | method, 213 | url, 214 | query_params=query_params, 215 | headers=header_params, 216 | post_params=post_params, 217 | body=body, 218 | _preload_content=_preload_content, 219 | _request_timeout=_request_timeout, 220 | ) 221 | except ApiException as e: 222 | e.body = e.body.decode("utf-8") 223 | raise e 224 | 225 | self.last_response = response_data 226 | 227 | return_data = response_data 228 | 229 | if not _preload_content: 230 | return return_data 231 | return return_data 232 | 233 | # deserialize response data 234 | if response_type: 235 | if response_type != (file_type,): 236 | encoding = "utf-8" 237 | content_type = response_data.getheader("content-type") 238 | if content_type is not None: 239 | match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) 240 | if match: 241 | encoding = match.group(1) 242 | response_data.data = response_data.data.decode(encoding) 243 | 244 | return_data = self.deserialize(response_data, response_type, _check_type) 245 | else: 246 | return_data = None 247 | 248 | if _return_http_data_only: 249 | return return_data 250 | else: 251 | return (return_data, response_data.status, response_data.getheaders()) 252 | 253 | def parameters_to_multipart(self, params, collection_types): 254 | """Get parameters as list of tuples, formatting as json if value is collection_types 255 | 256 | :param params: Parameters as list of two-tuples 257 | :param dict collection_types: Parameter collection types 258 | :return: Parameters as list of tuple or urllib3.fields.RequestField 259 | """ 260 | new_params = [] 261 | if collection_types is None: 262 | collection_types = dict 263 | for k, v in ( 264 | params.items() if isinstance(params, dict) else params 265 | ): # noqa: E501 266 | if isinstance( 267 | v, collection_types 268 | ): # v is instance of collection_type, formatting as application/json 269 | v = json.dumps(v, ensure_ascii=False).encode("utf-8") 270 | field = RequestField(k, v) 271 | field.make_multipart(content_type="application/json; charset=utf-8") 272 | new_params.append(field) 273 | else: 274 | new_params.append((k, v)) 275 | return new_params 276 | 277 | @classmethod 278 | def sanitize_for_serialization(cls, obj): 279 | """Prepares data for transmission before it is sent with the rest client 280 | If obj is None, return None. 281 | If obj is str, int, long, float, bool, return directly. 282 | If obj is datetime.datetime, datetime.date 283 | convert to string in iso8601 format. 284 | If obj is list, sanitize each element in the list. 285 | If obj is dict, return the dict. 286 | If obj is OpenAPI model, return the properties dict. 287 | If obj is io.IOBase, return the bytes 288 | :param obj: The data to serialize. 289 | :return: The serialized form of data. 290 | """ 291 | if isinstance(obj, (ModelNormal, ModelComposed)): 292 | return { 293 | key: cls.sanitize_for_serialization(val) 294 | for key, val in model_to_dict(obj, serialize=True).items() 295 | } 296 | elif isinstance(obj, io.IOBase): 297 | return cls.get_file_data_and_close_file(obj) 298 | elif isinstance(obj, (str, int, float, none_type, bool)): 299 | return obj 300 | elif isinstance(obj, (datetime, date)): 301 | return obj.isoformat() 302 | elif isinstance(obj, ModelSimple): 303 | return cls.sanitize_for_serialization(obj.value) 304 | elif isinstance(obj, (list, tuple)): 305 | return [cls.sanitize_for_serialization(item) for item in obj] 306 | if isinstance(obj, dict): 307 | return { 308 | key: cls.sanitize_for_serialization(val) for key, val in obj.items() 309 | } 310 | raise ApiValueError( 311 | "Unable to prepare type {} for serialization".format(obj.__class__.__name__) 312 | ) 313 | 314 | def deserialize(self, response, response_type, _check_type): 315 | """Deserializes response into an object. 316 | 317 | :param response: RESTResponse object to be deserialized. 318 | :param response_type: For the response, a tuple containing: 319 | valid classes 320 | a list containing valid classes (for list schemas) 321 | a dict containing a tuple of valid classes as the value 322 | Example values: 323 | (str,) 324 | (Pet,) 325 | (float, none_type) 326 | ([int, none_type],) 327 | ({str: (bool, str, int, float, date, datetime, str, none_type)},) 328 | :param _check_type: boolean, whether to check the types of the data 329 | received from the server 330 | :type _check_type: bool 331 | 332 | :return: deserialized object. 333 | """ 334 | # handle file downloading 335 | # save response body into a tmp file and return the instance 336 | if response_type == (file_type,): 337 | content_disposition = response.getheader("Content-Disposition") 338 | return deserialize_file( 339 | response.data, 340 | self.configuration, 341 | content_disposition=content_disposition, 342 | ) 343 | 344 | # fetch data from response object 345 | try: 346 | received_data = json.loads(response.data) 347 | except ValueError: 348 | received_data = response.data 349 | 350 | # store our data under the key of 'received_data' so users have some 351 | # context if they are deserializing a string and the data type is wrong 352 | deserialized_data = validate_and_convert_types( 353 | received_data, 354 | response_type, 355 | ["received_data"], 356 | True, 357 | _check_type, 358 | configuration=self.configuration, 359 | ) 360 | return deserialized_data 361 | 362 | def call_api( 363 | self, 364 | resource_path: str, 365 | method: str, 366 | path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, 367 | query_params: typing.Optional[ 368 | typing.List[typing.Tuple[str, typing.Any]] 369 | ] = None, 370 | header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, 371 | body: typing.Optional[typing.Any] = None, 372 | post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, 373 | files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, 374 | response_type: typing.Optional[typing.Tuple[typing.Any]] = None, 375 | auth_settings: typing.Optional[typing.List[str]] = None, 376 | async_req: typing.Optional[bool] = None, 377 | _return_http_data_only: typing.Optional[bool] = None, 378 | collection_formats: typing.Optional[typing.Dict[str, str]] = None, 379 | _preload_content: bool = True, 380 | _request_timeout: typing.Optional[ 381 | typing.Union[int, float, typing.Tuple] 382 | ] = None, 383 | _host: typing.Optional[str] = None, 384 | _check_type: typing.Optional[bool] = None, 385 | _request_auths: typing.Optional[ 386 | typing.List[typing.Dict[str, typing.Any]] 387 | ] = None, 388 | ): 389 | """Makes the HTTP request (synchronous) and returns deserialized data. 390 | 391 | To make an async_req request, set the async_req parameter. 392 | 393 | :param resource_path: Path to method endpoint. 394 | :param method: Method to call. 395 | :param path_params: Path parameters in the url. 396 | :param query_params: Query parameters in the url. 397 | :param header_params: Header parameters to be 398 | placed in the request header. 399 | :param body: Request body. 400 | :param post_params dict: Request post form parameters, 401 | for `application/x-www-form-urlencoded`, `multipart/form-data`. 402 | :param auth_settings list: Auth Settings names for the request. 403 | :param response_type: For the response, a tuple containing: 404 | valid classes 405 | a list containing valid classes (for list schemas) 406 | a dict containing a tuple of valid classes as the value 407 | Example values: 408 | (str,) 409 | (Pet,) 410 | (float, none_type) 411 | ([int, none_type],) 412 | ({str: (bool, str, int, float, date, datetime, str, none_type)},) 413 | :param files: key -> field name, value -> a list of open file 414 | objects for `multipart/form-data`. 415 | :type files: dict 416 | :param async_req bool: execute request asynchronously 417 | :type async_req: bool, optional 418 | :param _return_http_data_only: response data without head status code 419 | and headers 420 | :type _return_http_data_only: bool, optional 421 | :param collection_formats: dict of collection formats for path, query, 422 | header, and post parameters. 423 | :type collection_formats: dict, optional 424 | :param _preload_content: if False, the urllib3.HTTPResponse object will 425 | be returned without reading/decoding response 426 | data. Default is True. 427 | :type _preload_content: bool, optional 428 | :param _request_timeout: timeout setting for this request. If one 429 | number provided, it will be total request 430 | timeout. It can also be a pair (tuple) of 431 | (connection, read) timeouts. 432 | :param _check_type: boolean describing if the data back from the server 433 | should have its type checked. 434 | :type _check_type: bool, optional 435 | :param _request_auths: set to override the auth_settings for an a single 436 | request; this effectively ignores the authentication 437 | in the spec for a single request. 438 | :type _request_auths: list, optional 439 | :return: 440 | If async_req parameter is True, 441 | the request will be called asynchronously. 442 | The method will return the request thread. 443 | If parameter async_req is False or missing, 444 | then the method will return the response directly. 445 | """ 446 | if not async_req: 447 | return self.__call_api( 448 | resource_path, 449 | method, 450 | path_params, 451 | query_params, 452 | header_params, 453 | body, 454 | post_params, 455 | files, 456 | response_type, 457 | auth_settings, 458 | _return_http_data_only, 459 | collection_formats, 460 | _preload_content, 461 | _request_timeout, 462 | _host, 463 | _check_type, 464 | _request_auths=_request_auths, 465 | ) 466 | 467 | return self.pool.apply_async( 468 | self.__call_api, 469 | ( 470 | resource_path, 471 | method, 472 | path_params, 473 | query_params, 474 | header_params, 475 | body, 476 | post_params, 477 | files, 478 | response_type, 479 | auth_settings, 480 | _return_http_data_only, 481 | collection_formats, 482 | _preload_content, 483 | _request_timeout, 484 | _host, 485 | _check_type, 486 | None, 487 | _request_auths, 488 | ), 489 | ) 490 | 491 | def request( 492 | self, 493 | method, 494 | url, 495 | query_params=None, 496 | headers=None, 497 | post_params=None, 498 | body=None, 499 | _preload_content=True, 500 | _request_timeout=None, 501 | ): 502 | """Makes the HTTP request using RESTClient.""" 503 | if method == "GET": 504 | return self.rest_client.GET( 505 | url, 506 | query_params=query_params, 507 | _preload_content=_preload_content, 508 | _request_timeout=_request_timeout, 509 | headers=headers, 510 | ) 511 | elif method == "HEAD": 512 | return self.rest_client.HEAD( 513 | url, 514 | query_params=query_params, 515 | _preload_content=_preload_content, 516 | _request_timeout=_request_timeout, 517 | headers=headers, 518 | ) 519 | elif method == "OPTIONS": 520 | return self.rest_client.OPTIONS( 521 | url, 522 | query_params=query_params, 523 | headers=headers, 524 | post_params=post_params, 525 | _preload_content=_preload_content, 526 | _request_timeout=_request_timeout, 527 | body=body, 528 | ) 529 | elif method == "POST": 530 | return self.rest_client.POST( 531 | url, 532 | query_params=query_params, 533 | headers=headers, 534 | post_params=post_params, 535 | _preload_content=_preload_content, 536 | _request_timeout=_request_timeout, 537 | body=body, 538 | ) 539 | elif method == "PUT": 540 | return self.rest_client.PUT( 541 | url, 542 | query_params=query_params, 543 | headers=headers, 544 | post_params=post_params, 545 | _preload_content=_preload_content, 546 | _request_timeout=_request_timeout, 547 | body=body, 548 | ) 549 | elif method == "PATCH": 550 | return self.rest_client.PATCH( 551 | url, 552 | query_params=query_params, 553 | headers=headers, 554 | post_params=post_params, 555 | _preload_content=_preload_content, 556 | _request_timeout=_request_timeout, 557 | body=body, 558 | ) 559 | elif method == "DELETE": 560 | return self.rest_client.DELETE( 561 | url, 562 | query_params=query_params, 563 | headers=headers, 564 | _preload_content=_preload_content, 565 | _request_timeout=_request_timeout, 566 | body=body, 567 | ) 568 | else: 569 | raise ApiValueError( 570 | "http method must be `GET`, `HEAD`, `OPTIONS`," 571 | " `POST`, `PATCH`, `PUT` or `DELETE`." 572 | ) 573 | 574 | def parameters_to_tuples(self, params, collection_formats): 575 | """Get parameters as list of tuples, formatting collections. 576 | 577 | :param params: Parameters as dict or list of two-tuples 578 | :param dict collection_formats: Parameter collection formats 579 | :return: Parameters as list of tuples, collections formatted 580 | """ 581 | new_params = [] 582 | if collection_formats is None: 583 | collection_formats = {} 584 | for k, v in ( 585 | params.items() if isinstance(params, dict) else params 586 | ): # noqa: E501 587 | if k in collection_formats: 588 | collection_format = collection_formats[k] 589 | if collection_format == "multi": 590 | new_params.extend((k, value) for value in v) 591 | else: 592 | if collection_format == "ssv": 593 | delimiter = " " 594 | elif collection_format == "tsv": 595 | delimiter = "\t" 596 | elif collection_format == "pipes": 597 | delimiter = "|" 598 | else: # csv is the default 599 | delimiter = "," 600 | new_params.append((k, delimiter.join(str(value) for value in v))) 601 | else: 602 | new_params.append((k, v)) 603 | return new_params 604 | 605 | @staticmethod 606 | def get_file_data_and_close_file(file_instance: io.IOBase) -> bytes: 607 | file_data = file_instance.read() 608 | file_instance.close() 609 | return file_data 610 | 611 | def files_parameters( 612 | self, files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None 613 | ): 614 | """Builds form parameters. 615 | 616 | :param files: None or a dict with key=param_name and 617 | value is a list of open file objects 618 | :return: List of tuples of form parameters with file data 619 | """ 620 | if files is None: 621 | return [] 622 | 623 | params = [] 624 | for param_name, file_instances in files.items(): 625 | if file_instances is None: 626 | # if the file field is nullable, skip None values 627 | continue 628 | for file_instance in file_instances: 629 | if file_instance is None: 630 | # if the file field is nullable, skip None values 631 | continue 632 | if file_instance.closed is True: 633 | raise ApiValueError( 634 | "Cannot read a closed file. The passed in file_type " 635 | "for %s must be open." % param_name 636 | ) 637 | filename = os.path.basename(file_instance.name) 638 | filedata = self.get_file_data_and_close_file(file_instance) 639 | mimetype = ( 640 | mimetypes.guess_type(filename)[0] or "application/octet-stream" 641 | ) 642 | params.append( 643 | tuple([param_name, tuple([filename, filedata, mimetype])]) 644 | ) 645 | 646 | return params 647 | 648 | def select_header_accept(self, accepts): 649 | """Returns `Accept` based on an array of accepts provided. 650 | 651 | :param accepts: List of headers. 652 | :return: Accept (e.g. application/json). 653 | """ 654 | if not accepts: 655 | return 656 | 657 | accepts = [x.lower() for x in accepts] 658 | 659 | if "application/json" in accepts: 660 | return "application/json" 661 | else: 662 | return ", ".join(accepts) 663 | 664 | def select_header_content_type(self, content_types, method=None, body=None): 665 | """Returns `Content-Type` based on an array of content_types provided. 666 | 667 | :param content_types: List of content-types. 668 | :param method: http method (e.g. POST, PATCH). 669 | :param body: http body to send. 670 | :return: Content-Type (e.g. application/json). 671 | """ 672 | if not content_types: 673 | return None 674 | 675 | content_types = [x.lower() for x in content_types] 676 | 677 | if ( 678 | method == "PATCH" 679 | and "application/json-patch+json" in content_types 680 | and isinstance(body, list) 681 | ): 682 | return "application/json-patch+json" 683 | 684 | if "application/json" in content_types or "*/*" in content_types: 685 | return "application/json" 686 | else: 687 | return content_types[0] 688 | 689 | def update_params_for_auth( 690 | self, 691 | headers, 692 | queries, 693 | auth_settings, 694 | resource_path, 695 | method, 696 | body, 697 | request_auths=None, 698 | ): 699 | """Updates header and query params based on authentication setting. 700 | 701 | :param headers: Header parameters dict to be updated. 702 | :param queries: Query parameters tuple list to be updated. 703 | :param auth_settings: Authentication setting identifiers list. 704 | :param resource_path: A string representation of the HTTP request resource path. 705 | :param method: A string representation of the HTTP request method. 706 | :param body: A object representing the body of the HTTP request. 707 | The object type is the return value of _encoder.default(). 708 | :param request_auths: if set, the provided settings will 709 | override the token in the configuration. 710 | """ 711 | if not auth_settings: 712 | return 713 | 714 | if request_auths: 715 | for auth_setting in request_auths: 716 | self._apply_auth_params( 717 | headers, queries, resource_path, method, body, auth_setting 718 | ) 719 | return 720 | 721 | for auth in auth_settings: 722 | auth_setting = self.configuration.auth_settings().get(auth) 723 | if auth_setting: 724 | self._apply_auth_params( 725 | headers, queries, resource_path, method, body, auth_setting 726 | ) 727 | 728 | def _apply_auth_params( 729 | self, headers, queries, resource_path, method, body, auth_setting 730 | ): 731 | if auth_setting["in"] == "cookie": 732 | headers["Cookie"] = auth_setting["key"] + "=" + auth_setting["value"] 733 | elif auth_setting["in"] == "header": 734 | if auth_setting["type"] != "http-signature": 735 | headers[auth_setting["key"]] = auth_setting["value"] 736 | elif auth_setting["in"] == "query": 737 | queries.append((auth_setting["key"], auth_setting["value"])) 738 | else: 739 | raise ApiValueError("Authentication token must be in `query` or `header`") 740 | 741 | 742 | class Endpoint(object): 743 | def __init__( 744 | self, 745 | settings=None, 746 | params_map=None, 747 | root_map=None, 748 | headers_map=None, 749 | api_client=None, 750 | callable=None, 751 | ): 752 | """Creates an endpoint 753 | 754 | Args: 755 | settings (dict): see below key value pairs 756 | 'response_type' (tuple/None): response type 757 | 'auth' (list): a list of auth type keys 758 | 'endpoint_path' (str): the endpoint path 759 | 'operation_id' (str): endpoint string identifier 760 | 'http_method' (str): POST/PUT/PATCH/GET etc 761 | 'servers' (list): list of str servers that this endpoint is at 762 | params_map (dict): see below key value pairs 763 | 'all' (list): list of str endpoint parameter names 764 | 'required' (list): list of required parameter names 765 | 'nullable' (list): list of nullable parameter names 766 | 'enum' (list): list of parameters with enum values 767 | 'validation' (list): list of parameters with validations 768 | root_map 769 | 'validations' (dict): the dict mapping endpoint parameter tuple 770 | paths to their validation dictionaries 771 | 'allowed_values' (dict): the dict mapping endpoint parameter 772 | tuple paths to their allowed_values (enum) dictionaries 773 | 'openapi_types' (dict): param_name to openapi type 774 | 'attribute_map' (dict): param_name to camelCase name 775 | 'location_map' (dict): param_name to 'body', 'file', 'form', 776 | 'header', 'path', 'query' 777 | collection_format_map (dict): param_name to `csv` etc. 778 | headers_map (dict): see below key value pairs 779 | 'accept' (list): list of Accept header strings 780 | 'content_type' (list): list of Content-Type header strings 781 | api_client (ApiClient) api client instance 782 | callable (function): the function which is invoked when the 783 | Endpoint is called 784 | """ 785 | self.settings = settings 786 | self.params_map = params_map 787 | self.params_map["all"].extend( 788 | [ 789 | "async_req", 790 | "_host_index", 791 | "_preload_content", 792 | "_request_timeout", 793 | "_return_http_data_only", 794 | "_check_input_type", 795 | "_check_return_type", 796 | "_content_type", 797 | "_spec_property_naming", 798 | "_request_auths", 799 | ] 800 | ) 801 | self.params_map["nullable"].extend(["_request_timeout"]) 802 | self.validations = root_map["validations"] 803 | self.allowed_values = root_map["allowed_values"] 804 | self.openapi_types = root_map["openapi_types"] 805 | extra_types = { 806 | "async_req": (bool,), 807 | "_host_index": (none_type, int), 808 | "_preload_content": (bool,), 809 | "_request_timeout": ( 810 | none_type, 811 | float, 812 | (float,), 813 | [float], 814 | int, 815 | (int,), 816 | [int], 817 | ), 818 | "_return_http_data_only": (bool,), 819 | "_check_input_type": (bool,), 820 | "_check_return_type": (bool,), 821 | "_spec_property_naming": (bool,), 822 | "_content_type": (none_type, str), 823 | "_request_auths": (none_type, list), 824 | } 825 | self.openapi_types.update(extra_types) 826 | self.attribute_map = root_map["attribute_map"] 827 | self.location_map = root_map["location_map"] 828 | self.collection_format_map = root_map["collection_format_map"] 829 | self.headers_map = headers_map 830 | self.api_client = api_client 831 | self.callable = callable 832 | 833 | def __validate_inputs(self, kwargs): 834 | for param in self.params_map["enum"]: 835 | if param in kwargs: 836 | check_allowed_values(self.allowed_values, (param,), kwargs[param]) 837 | 838 | for param in self.params_map["validation"]: 839 | if param in kwargs: 840 | check_validations( 841 | self.validations, 842 | (param,), 843 | kwargs[param], 844 | configuration=self.api_client.configuration, 845 | ) 846 | 847 | if kwargs["_check_input_type"] is False: 848 | return 849 | 850 | for key, value in kwargs.items(): 851 | fixed_val = validate_and_convert_types( 852 | value, 853 | self.openapi_types[key], 854 | [key], 855 | kwargs["_spec_property_naming"], 856 | kwargs["_check_input_type"], 857 | configuration=self.api_client.configuration, 858 | ) 859 | kwargs[key] = fixed_val 860 | 861 | def __gather_params(self, kwargs): 862 | params = { 863 | "body": None, 864 | "collection_format": {}, 865 | "file": {}, 866 | "form": [], 867 | "header": {}, 868 | "path": {}, 869 | "query": [], 870 | } 871 | 872 | for param_name, param_value in kwargs.items(): 873 | param_location = self.location_map.get(param_name) 874 | if param_location is None: 875 | continue 876 | if param_location: 877 | if param_location == "body": 878 | params["body"] = param_value 879 | continue 880 | base_name = self.attribute_map[param_name] 881 | if param_location == "form" and self.openapi_types[param_name] == ( 882 | file_type, 883 | ): 884 | params["file"][base_name] = [param_value] 885 | elif param_location == "form" and self.openapi_types[param_name] == ( 886 | [file_type], 887 | ): 888 | # param_value is already a list 889 | params["file"][base_name] = param_value 890 | elif param_location in {"form", "query"}: 891 | param_value_full = (base_name, param_value) 892 | params[param_location].append(param_value_full) 893 | if param_location not in {"form", "query"}: 894 | params[param_location][base_name] = param_value 895 | collection_format = self.collection_format_map.get(param_name) 896 | if collection_format: 897 | params["collection_format"][base_name] = collection_format 898 | 899 | return params 900 | 901 | def __call__(self, *args, **kwargs): 902 | """This method is invoked when endpoints are called 903 | Example: 904 | 905 | api_instance = DefaultApi() 906 | api_instance.get_feiertage # this is an instance of the class Endpoint 907 | api_instance.get_feiertage() # this invokes api_instance.get_feiertage.__call__() 908 | which then invokes the callable functions stored in that endpoint at 909 | api_instance.get_feiertage.callable or self.callable in this class 910 | 911 | """ 912 | return self.callable(self, *args, **kwargs) 913 | 914 | def call_with_http_info(self, **kwargs): 915 | 916 | try: 917 | index = ( 918 | self.api_client.configuration.server_operation_index.get( 919 | self.settings["operation_id"], 920 | self.api_client.configuration.server_index, 921 | ) 922 | if kwargs["_host_index"] is None 923 | else kwargs["_host_index"] 924 | ) 925 | server_variables = ( 926 | self.api_client.configuration.server_operation_variables.get( 927 | self.settings["operation_id"], 928 | self.api_client.configuration.server_variables, 929 | ) 930 | ) 931 | _host = self.api_client.configuration.get_host_from_settings( 932 | index, variables=server_variables, servers=self.settings["servers"] 933 | ) 934 | except IndexError: 935 | if self.settings["servers"]: 936 | raise ApiValueError( 937 | "Invalid host index. Must be 0 <= index < %s" 938 | % len(self.settings["servers"]) 939 | ) 940 | _host = None 941 | 942 | for key, value in kwargs.items(): 943 | if key not in self.params_map["all"]: 944 | raise ApiTypeError( 945 | "Got an unexpected parameter '%s'" 946 | " to method `%s`" % (key, self.settings["operation_id"]) 947 | ) 948 | # only throw this nullable ApiValueError if _check_input_type 949 | # is False, if _check_input_type==True we catch this case 950 | # in self.__validate_inputs 951 | if ( 952 | key not in self.params_map["nullable"] 953 | and value is None 954 | and kwargs["_check_input_type"] is False 955 | ): 956 | raise ApiValueError( 957 | "Value may not be None for non-nullable parameter `%s`" 958 | " when calling `%s`" % (key, self.settings["operation_id"]) 959 | ) 960 | 961 | for key in self.params_map["required"]: 962 | if key not in kwargs.keys(): 963 | raise ApiValueError( 964 | "Missing the required parameter `%s` when calling " 965 | "`%s`" % (key, self.settings["operation_id"]) 966 | ) 967 | 968 | self.__validate_inputs(kwargs) 969 | 970 | params = self.__gather_params(kwargs) 971 | 972 | accept_headers_list = self.headers_map["accept"] 973 | if accept_headers_list: 974 | params["header"]["Accept"] = self.api_client.select_header_accept( 975 | accept_headers_list 976 | ) 977 | 978 | if kwargs.get("_content_type"): 979 | params["header"]["Content-Type"] = kwargs["_content_type"] 980 | else: 981 | content_type_headers_list = self.headers_map["content_type"] 982 | if content_type_headers_list: 983 | if params["body"] != "": 984 | content_types_list = self.api_client.select_header_content_type( 985 | content_type_headers_list, 986 | self.settings["http_method"], 987 | params["body"], 988 | ) 989 | if content_types_list: 990 | params["header"]["Content-Type"] = content_types_list 991 | 992 | return self.api_client.call_api( 993 | self.settings["endpoint_path"], 994 | self.settings["http_method"], 995 | params["path"], 996 | params["query"], 997 | params["header"], 998 | body=params["body"], 999 | post_params=params["form"], 1000 | files=params["file"], 1001 | response_type=self.settings["response_type"], 1002 | auth_settings=self.settings["auth"], 1003 | async_req=kwargs["async_req"], 1004 | _check_type=kwargs["_check_return_type"], 1005 | _return_http_data_only=kwargs["_return_http_data_only"], 1006 | _preload_content=kwargs["_preload_content"], 1007 | _request_timeout=kwargs["_request_timeout"], 1008 | _host=_host, 1009 | _request_auths=kwargs["_request_auths"], 1010 | collection_formats=params["collection_format"], 1011 | ) 1012 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/apis/__init__.py: -------------------------------------------------------------------------------- 1 | # flake8: noqa 2 | 3 | # Import all APIs into this package. 4 | # If you have many APIs here with many many models used in each API this may 5 | # raise a `RecursionError`. 6 | # In order to avoid this, import only the API that you directly need like: 7 | # 8 | # from deutschland.feiertage.api.default_api import DefaultApi 9 | # 10 | # or import this package, but before doing it, use: 11 | # 12 | # import sys 13 | # sys.setrecursionlimit(n) 14 | 15 | # Import APIs into API package: 16 | from deutschland.feiertage.api.default_api import DefaultApi 17 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/configuration.py: -------------------------------------------------------------------------------- 1 | """ 2 | Feiertage API 3 | 4 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 5 | 6 | The version of the OpenAPI document: 1.0.0 7 | Contact: kontakt@bund.dev 8 | Generated by: https://openapi-generator.tech 9 | """ 10 | 11 | import copy 12 | import logging 13 | import multiprocessing 14 | import sys 15 | from http import client as http_client 16 | 17 | import urllib3 18 | from deutschland.feiertage.exceptions import ApiValueError 19 | 20 | JSON_SCHEMA_VALIDATION_KEYWORDS = { 21 | "multipleOf", 22 | "maximum", 23 | "exclusiveMaximum", 24 | "minimum", 25 | "exclusiveMinimum", 26 | "maxLength", 27 | "minLength", 28 | "pattern", 29 | "maxItems", 30 | "minItems", 31 | } 32 | 33 | 34 | class Configuration(object): 35 | """NOTE: This class is auto generated by OpenAPI Generator 36 | 37 | Ref: https://openapi-generator.tech 38 | Do not edit the class manually. 39 | 40 | :param host: Base url 41 | :param api_key: Dict to store API key(s). 42 | Each entry in the dict specifies an API key. 43 | The dict key is the name of the security scheme in the OAS specification. 44 | The dict value is the API key secret. 45 | :param api_key_prefix: Dict to store API prefix (e.g. Bearer) 46 | The dict key is the name of the security scheme in the OAS specification. 47 | The dict value is an API key prefix when generating the auth data. 48 | :param username: Username for HTTP basic authentication 49 | :param password: Password for HTTP basic authentication 50 | :param discard_unknown_keys: Boolean value indicating whether to discard 51 | unknown properties. A server may send a response that includes additional 52 | properties that are not known by the client in the following scenarios: 53 | 1. The OpenAPI document is incomplete, i.e. it does not match the server 54 | implementation. 55 | 2. The client was generated using an older version of the OpenAPI document 56 | and the server has been upgraded since then. 57 | If a schema in the OpenAPI document defines the additionalProperties attribute, 58 | then all undeclared properties received by the server are injected into the 59 | additional properties map. In that case, there are undeclared properties, and 60 | nothing to discard. 61 | :param disabled_client_side_validations (string): Comma-separated list of 62 | JSON schema validation keywords to disable JSON schema structural validation 63 | rules. The following keywords may be specified: multipleOf, maximum, 64 | exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, 65 | maxItems, minItems. 66 | By default, the validation is performed for data generated locally by the client 67 | and data received from the server, independent of any validation performed by 68 | the server side. If the input data does not satisfy the JSON schema validation 69 | rules specified in the OpenAPI document, an exception is raised. 70 | If disabled_client_side_validations is set, structural validation is 71 | disabled. This can be useful to troubleshoot data validation problem, such as 72 | when the OpenAPI document validation rules do not match the actual API data 73 | received by the server. 74 | :param server_index: Index to servers configuration. 75 | :param server_variables: Mapping with string values to replace variables in 76 | templated server configuration. The validation of enums is performed for 77 | variables with defined enum values before. 78 | :param server_operation_index: Mapping from operation ID to an index to server 79 | configuration. 80 | :param server_operation_variables: Mapping from operation ID to a mapping with 81 | string values to replace variables in templated server configuration. 82 | The validation of enums is performed for variables with defined enum values before. 83 | :param ssl_ca_cert: str - the path to a file of concatenated CA certificates 84 | in PEM format 85 | 86 | """ 87 | 88 | _default = None 89 | 90 | def __init__( 91 | self, 92 | host=None, 93 | api_key=None, 94 | api_key_prefix=None, 95 | access_token=None, 96 | username=None, 97 | password=None, 98 | discard_unknown_keys=False, 99 | disabled_client_side_validations="", 100 | server_index=None, 101 | server_variables=None, 102 | server_operation_index=None, 103 | server_operation_variables=None, 104 | ssl_ca_cert=None, 105 | ): 106 | """Constructor""" 107 | self._base_path = "https://feiertage-api.de/api" if host is None else host 108 | """Default Base url 109 | """ 110 | self.server_index = 0 if server_index is None and host is None else server_index 111 | self.server_operation_index = server_operation_index or {} 112 | """Default server index 113 | """ 114 | self.server_variables = server_variables or {} 115 | self.server_operation_variables = server_operation_variables or {} 116 | """Default server variables 117 | """ 118 | self.temp_folder_path = None 119 | """Temp file folder for downloading files 120 | """ 121 | # Authentication Settings 122 | self.access_token = access_token 123 | self.api_key = {} 124 | if api_key: 125 | self.api_key = api_key 126 | """dict to store API key(s) 127 | """ 128 | self.api_key_prefix = {} 129 | if api_key_prefix: 130 | self.api_key_prefix = api_key_prefix 131 | """dict to store API prefix (e.g. Bearer) 132 | """ 133 | self.refresh_api_key_hook = None 134 | """function hook to refresh API key if expired 135 | """ 136 | self.username = username 137 | """Username for HTTP basic authentication 138 | """ 139 | self.password = password 140 | """Password for HTTP basic authentication 141 | """ 142 | self.discard_unknown_keys = discard_unknown_keys 143 | self.disabled_client_side_validations = disabled_client_side_validations 144 | self.logger = {} 145 | """Logging Settings 146 | """ 147 | self.logger["package_logger"] = logging.getLogger("feiertage") 148 | self.logger["urllib3_logger"] = logging.getLogger("urllib3") 149 | self.logger_format = "%(asctime)s %(levelname)s %(message)s" 150 | """Log format 151 | """ 152 | self.logger_stream_handler = None 153 | """Log stream handler 154 | """ 155 | self.logger_file_handler = None 156 | """Log file handler 157 | """ 158 | self.logger_file = None 159 | """Debug file location 160 | """ 161 | self.debug = False 162 | """Debug switch 163 | """ 164 | 165 | self.verify_ssl = True 166 | """SSL/TLS verification 167 | Set this to false to skip verifying SSL certificate when calling API 168 | from https server. 169 | """ 170 | self.ssl_ca_cert = ssl_ca_cert 171 | """Set this to customize the certificate file to verify the peer. 172 | """ 173 | self.cert_file = None 174 | """client certificate file 175 | """ 176 | self.key_file = None 177 | """client key file 178 | """ 179 | self.assert_hostname = None 180 | """Set this to True/False to enable/disable SSL hostname verification. 181 | """ 182 | 183 | self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 184 | """urllib3 connection pool's maximum number of connections saved 185 | per pool. urllib3 uses 1 connection as default value, but this is 186 | not the best value when you are making a lot of possibly parallel 187 | requests to the same host, which is often the case here. 188 | cpu_count * 5 is used as default value to increase performance. 189 | """ 190 | 191 | self.proxy = None 192 | """Proxy URL 193 | """ 194 | self.no_proxy = None 195 | """bypass proxy for host in the no_proxy list. 196 | """ 197 | self.proxy_headers = None 198 | """Proxy headers 199 | """ 200 | self.safe_chars_for_path_param = "" 201 | """Safe chars for path_param 202 | """ 203 | self.retries = None 204 | """Adding retries to override urllib3 default value 3 205 | """ 206 | # Enable client side validation 207 | self.client_side_validation = True 208 | 209 | # Options to pass down to the underlying urllib3 socket 210 | self.socket_options = None 211 | 212 | def __deepcopy__(self, memo): 213 | cls = self.__class__ 214 | result = cls.__new__(cls) 215 | memo[id(self)] = result 216 | for k, v in self.__dict__.items(): 217 | if k not in ("logger", "logger_file_handler"): 218 | setattr(result, k, copy.deepcopy(v, memo)) 219 | # shallow copy of loggers 220 | result.logger = copy.copy(self.logger) 221 | # use setters to configure loggers 222 | result.logger_file = self.logger_file 223 | result.debug = self.debug 224 | return result 225 | 226 | def __setattr__(self, name, value): 227 | object.__setattr__(self, name, value) 228 | if name == "disabled_client_side_validations": 229 | s = set(filter(None, value.split(","))) 230 | for v in s: 231 | if v not in JSON_SCHEMA_VALIDATION_KEYWORDS: 232 | raise ApiValueError("Invalid keyword: '{0}''".format(v)) 233 | self._disabled_client_side_validations = s 234 | 235 | @classmethod 236 | def set_default(cls, default): 237 | """Set default instance of configuration. 238 | 239 | It stores default configuration, which can be 240 | returned by get_default_copy method. 241 | 242 | :param default: object of Configuration 243 | """ 244 | cls._default = copy.deepcopy(default) 245 | 246 | @classmethod 247 | def get_default_copy(cls): 248 | """Return new instance of configuration. 249 | 250 | This method returns newly created, based on default constructor, 251 | object of Configuration class or returns a copy of default 252 | configuration passed by the set_default method. 253 | 254 | :return: The configuration object. 255 | """ 256 | if cls._default is not None: 257 | return copy.deepcopy(cls._default) 258 | return Configuration() 259 | 260 | @property 261 | def logger_file(self): 262 | """The logger file. 263 | 264 | If the logger_file is None, then add stream handler and remove file 265 | handler. Otherwise, add file handler and remove stream handler. 266 | 267 | :param value: The logger_file path. 268 | :type: str 269 | """ 270 | return self.__logger_file 271 | 272 | @logger_file.setter 273 | def logger_file(self, value): 274 | """The logger file. 275 | 276 | If the logger_file is None, then add stream handler and remove file 277 | handler. Otherwise, add file handler and remove stream handler. 278 | 279 | :param value: The logger_file path. 280 | :type: str 281 | """ 282 | self.__logger_file = value 283 | if self.__logger_file: 284 | # If set logging file, 285 | # then add file handler and remove stream handler. 286 | self.logger_file_handler = logging.FileHandler(self.__logger_file) 287 | self.logger_file_handler.setFormatter(self.logger_formatter) 288 | for _, logger in self.logger.items(): 289 | logger.addHandler(self.logger_file_handler) 290 | 291 | @property 292 | def debug(self): 293 | """Debug status 294 | 295 | :param value: The debug status, True or False. 296 | :type: bool 297 | """ 298 | return self.__debug 299 | 300 | @debug.setter 301 | def debug(self, value): 302 | """Debug status 303 | 304 | :param value: The debug status, True or False. 305 | :type: bool 306 | """ 307 | self.__debug = value 308 | if self.__debug: 309 | # if debug status is True, turn on debug logging 310 | for _, logger in self.logger.items(): 311 | logger.setLevel(logging.DEBUG) 312 | # turn on http_client debug 313 | http_client.HTTPConnection.debuglevel = 1 314 | else: 315 | # if debug status is False, turn off debug logging, 316 | # setting log level to default `logging.WARNING` 317 | for _, logger in self.logger.items(): 318 | logger.setLevel(logging.WARNING) 319 | # turn off http_client debug 320 | http_client.HTTPConnection.debuglevel = 0 321 | 322 | @property 323 | def logger_format(self): 324 | """The logger format. 325 | 326 | The logger_formatter will be updated when sets logger_format. 327 | 328 | :param value: The format string. 329 | :type: str 330 | """ 331 | return self.__logger_format 332 | 333 | @logger_format.setter 334 | def logger_format(self, value): 335 | """The logger format. 336 | 337 | The logger_formatter will be updated when sets logger_format. 338 | 339 | :param value: The format string. 340 | :type: str 341 | """ 342 | self.__logger_format = value 343 | self.logger_formatter = logging.Formatter(self.__logger_format) 344 | 345 | def get_api_key_with_prefix(self, identifier, alias=None): 346 | """Gets API key (with prefix if set). 347 | 348 | :param identifier: The identifier of apiKey. 349 | :param alias: The alternative identifier of apiKey. 350 | :return: The token for api key authentication. 351 | """ 352 | if self.refresh_api_key_hook is not None: 353 | self.refresh_api_key_hook(self) 354 | key = self.api_key.get( 355 | identifier, self.api_key.get(alias) if alias is not None else None 356 | ) 357 | if key: 358 | prefix = self.api_key_prefix.get(identifier) 359 | if prefix: 360 | return "%s %s" % (prefix, key) 361 | else: 362 | return key 363 | 364 | def get_basic_auth_token(self): 365 | """Gets HTTP basic authentication header (string). 366 | 367 | :return: The token for basic HTTP authentication. 368 | """ 369 | username = "" 370 | if self.username is not None: 371 | username = self.username 372 | password = "" 373 | if self.password is not None: 374 | password = self.password 375 | return urllib3.util.make_headers(basic_auth=username + ":" + password).get( 376 | "authorization" 377 | ) 378 | 379 | def auth_settings(self): 380 | """Gets Auth Settings dict for api client. 381 | 382 | :return: The Auth Settings information dict. 383 | """ 384 | auth = {} 385 | return auth 386 | 387 | def to_debug_report(self): 388 | """Gets the essential information for debugging. 389 | 390 | :return: The report for debugging. 391 | """ 392 | return ( 393 | "Python SDK Debug Report:\n" 394 | "OS: {env}\n" 395 | "Python Version: {pyversion}\n" 396 | "Version of the API: 1.0.0\n" 397 | "SDK Package Version: 1.0.2".format(env=sys.platform, pyversion=sys.version) 398 | ) 399 | 400 | def get_host_settings(self): 401 | """Gets an array of host settings 402 | 403 | :return: An array of host settings 404 | """ 405 | return [ 406 | { 407 | "url": "https://feiertage-api.de/api", 408 | "description": "No description provided", 409 | } 410 | ] 411 | 412 | def get_host_from_settings(self, index, variables=None, servers=None): 413 | """Gets host URL based on the index and variables 414 | :param index: array index of the host settings 415 | :param variables: hash of variable and the corresponding value 416 | :param servers: an array of host settings or None 417 | :return: URL based on host settings 418 | """ 419 | if index is None: 420 | return self._base_path 421 | 422 | variables = {} if variables is None else variables 423 | servers = self.get_host_settings() if servers is None else servers 424 | 425 | try: 426 | server = servers[index] 427 | except IndexError: 428 | raise ValueError( 429 | "Invalid index {0} when selecting the host settings. " 430 | "Must be less than {1}".format(index, len(servers)) 431 | ) 432 | 433 | url = server["url"] 434 | 435 | # go through variables and replace placeholders 436 | for variable_name, variable in server.get("variables", {}).items(): 437 | used_value = variables.get(variable_name, variable["default_value"]) 438 | 439 | if "enum_values" in variable and used_value not in variable["enum_values"]: 440 | raise ValueError( 441 | "The variable `{0}` in the host URL has invalid value " 442 | "{1}. Must be {2}.".format( 443 | variable_name, variables[variable_name], variable["enum_values"] 444 | ) 445 | ) 446 | 447 | url = url.replace("{" + variable_name + "}", used_value) 448 | 449 | return url 450 | 451 | @property 452 | def host(self): 453 | """Return generated host.""" 454 | return self.get_host_from_settings( 455 | self.server_index, variables=self.server_variables 456 | ) 457 | 458 | @host.setter 459 | def host(self, value): 460 | """Fix base path.""" 461 | self._base_path = value 462 | self.server_index = None 463 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Feiertage API 3 | 4 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 5 | 6 | The version of the OpenAPI document: 1.0.0 7 | Contact: kontakt@bund.dev 8 | Generated by: https://openapi-generator.tech 9 | """ 10 | 11 | 12 | class OpenApiException(Exception): 13 | """The base exception class for all OpenAPIExceptions""" 14 | 15 | 16 | class ApiTypeError(OpenApiException, TypeError): 17 | def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): 18 | """Raises an exception for TypeErrors 19 | 20 | Args: 21 | msg (str): the exception message 22 | 23 | Keyword Args: 24 | path_to_item (list): a list of keys an indices to get to the 25 | current_item 26 | None if unset 27 | valid_classes (tuple): the primitive classes that current item 28 | should be an instance of 29 | None if unset 30 | key_type (bool): False if our value is a value in a dict 31 | True if it is a key in a dict 32 | False if our item is an item in a list 33 | None if unset 34 | """ 35 | self.path_to_item = path_to_item 36 | self.valid_classes = valid_classes 37 | self.key_type = key_type 38 | full_msg = msg 39 | if path_to_item: 40 | full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 41 | super(ApiTypeError, self).__init__(full_msg) 42 | 43 | 44 | class ApiValueError(OpenApiException, ValueError): 45 | def __init__(self, msg, path_to_item=None): 46 | """ 47 | Args: 48 | msg (str): the exception message 49 | 50 | Keyword Args: 51 | path_to_item (list) the path to the exception in the 52 | received_data dict. None if unset 53 | """ 54 | 55 | self.path_to_item = path_to_item 56 | full_msg = msg 57 | if path_to_item: 58 | full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 59 | super(ApiValueError, self).__init__(full_msg) 60 | 61 | 62 | class ApiAttributeError(OpenApiException, AttributeError): 63 | def __init__(self, msg, path_to_item=None): 64 | """ 65 | Raised when an attribute reference or assignment fails. 66 | 67 | Args: 68 | msg (str): the exception message 69 | 70 | Keyword Args: 71 | path_to_item (None/list) the path to the exception in the 72 | received_data dict 73 | """ 74 | self.path_to_item = path_to_item 75 | full_msg = msg 76 | if path_to_item: 77 | full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 78 | super(ApiAttributeError, self).__init__(full_msg) 79 | 80 | 81 | class ApiKeyError(OpenApiException, KeyError): 82 | def __init__(self, msg, path_to_item=None): 83 | """ 84 | Args: 85 | msg (str): the exception message 86 | 87 | Keyword Args: 88 | path_to_item (None/list) the path to the exception in the 89 | received_data dict 90 | """ 91 | self.path_to_item = path_to_item 92 | full_msg = msg 93 | if path_to_item: 94 | full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 95 | super(ApiKeyError, self).__init__(full_msg) 96 | 97 | 98 | class ApiException(OpenApiException): 99 | 100 | def __init__(self, status=None, reason=None, http_resp=None): 101 | if http_resp: 102 | self.status = http_resp.status 103 | self.reason = http_resp.reason 104 | self.body = http_resp.data 105 | self.headers = http_resp.getheaders() 106 | else: 107 | self.status = status 108 | self.reason = reason 109 | self.body = None 110 | self.headers = None 111 | 112 | def __str__(self): 113 | """Custom error messages for exception""" 114 | error_message = "Status Code: {0}\n" "Reason: {1}\n".format( 115 | self.status, self.reason 116 | ) 117 | if self.headers: 118 | error_message += "HTTP response headers: {0}\n".format(self.headers) 119 | 120 | if self.body: 121 | error_message += "HTTP response body: {0}\n".format(self.body) 122 | 123 | return error_message 124 | 125 | 126 | class NotFoundException(ApiException): 127 | 128 | def __init__(self, status=None, reason=None, http_resp=None): 129 | super(NotFoundException, self).__init__(status, reason, http_resp) 130 | 131 | 132 | class UnauthorizedException(ApiException): 133 | 134 | def __init__(self, status=None, reason=None, http_resp=None): 135 | super(UnauthorizedException, self).__init__(status, reason, http_resp) 136 | 137 | 138 | class ForbiddenException(ApiException): 139 | 140 | def __init__(self, status=None, reason=None, http_resp=None): 141 | super(ForbiddenException, self).__init__(status, reason, http_resp) 142 | 143 | 144 | class ServiceException(ApiException): 145 | 146 | def __init__(self, status=None, reason=None, http_resp=None): 147 | super(ServiceException, self).__init__(status, reason, http_resp) 148 | 149 | 150 | def render_path(path_to_item): 151 | """Returns a string representation of a path""" 152 | result = "" 153 | for pth in path_to_item: 154 | if isinstance(pth, int): 155 | result += "[{0}]".format(pth) 156 | else: 157 | result += "['{0}']".format(pth) 158 | return result 159 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/model/__init__.py: -------------------------------------------------------------------------------- 1 | # we can not import model classes here because that would create a circular 2 | # reference which would not work in python2 3 | # do not import all models into this module because that uses a lot of memory and stack frames 4 | # if you need the ability to import all models from one package, import them with 5 | # from deutschland.feiertage.models import ModelA, ModelB 6 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/model/feiertag.py: -------------------------------------------------------------------------------- 1 | """ 2 | Feiertage API 3 | 4 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 5 | 6 | The version of the OpenAPI document: 1.0.0 7 | Contact: kontakt@bund.dev 8 | Generated by: https://openapi-generator.tech 9 | """ 10 | 11 | import re # noqa: F401 12 | import sys # noqa: F401 13 | 14 | from deutschland.feiertage.exceptions import ApiAttributeError 15 | from deutschland.feiertage.model_utils import ( # noqa: F401 16 | ApiTypeError, 17 | ModelComposed, 18 | ModelNormal, 19 | ModelSimple, 20 | OpenApiModel, 21 | cached_property, 22 | change_keys_js_to_python, 23 | convert_js_args_to_python_args, 24 | date, 25 | datetime, 26 | file_type, 27 | none_type, 28 | validate_get_composed_info, 29 | ) 30 | 31 | 32 | class Feiertag(ModelNormal): 33 | """NOTE: This class is auto generated by OpenAPI Generator. 34 | Ref: https://openapi-generator.tech 35 | 36 | Do not edit the class manually. 37 | 38 | Attributes: 39 | allowed_values (dict): The key is the tuple path to the attribute 40 | and the for var_name this is (var_name,). The value is a dict 41 | with a capitalized key describing the allowed value and an allowed 42 | value. These dicts store the allowed enum values. 43 | attribute_map (dict): The key is attribute name 44 | and the value is json key in definition. 45 | discriminator_value_class_map (dict): A dict to go from the discriminator 46 | variable value to the discriminator class name. 47 | validations (dict): The key is the tuple path to the attribute 48 | and the for var_name this is (var_name,). The value is a dict 49 | that stores validations for max_length, min_length, max_items, 50 | min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 51 | inclusive_minimum, and regex. 52 | additional_properties_type (tuple): A tuple of classes accepted 53 | as additional properties values. 54 | """ 55 | 56 | allowed_values = {} 57 | 58 | validations = {} 59 | 60 | @cached_property 61 | def additional_properties_type(): 62 | """ 63 | This must be a method because a model may have properties that are 64 | of type self, this must run after the class is loaded 65 | """ 66 | return ( 67 | bool, 68 | date, 69 | datetime, 70 | dict, 71 | float, 72 | int, 73 | list, 74 | str, 75 | none_type, 76 | ) # noqa: E501 77 | 78 | _nullable = False 79 | 80 | @cached_property 81 | def openapi_types(): 82 | """ 83 | This must be a method because a model may have properties that are 84 | of type self, this must run after the class is loaded 85 | 86 | Returns 87 | openapi_types (dict): The key is attribute name 88 | and the value is attribute type. 89 | """ 90 | return { 91 | "datum": (str,), # noqa: E501 92 | "hinweis": (str,), # noqa: E501 93 | } 94 | 95 | @cached_property 96 | def discriminator(): 97 | return None 98 | 99 | attribute_map = { 100 | "datum": "datum", # noqa: E501 101 | "hinweis": "hinweis", # noqa: E501 102 | } 103 | 104 | read_only_vars = {} 105 | 106 | _composed_schemas = {} 107 | 108 | @classmethod 109 | @convert_js_args_to_python_args 110 | def _from_openapi_data(cls, datum, *args, **kwargs): # noqa: E501 111 | """Feiertag - a model defined in OpenAPI 112 | 113 | Args: 114 | datum (str): 115 | 116 | Keyword Args: 117 | _check_type (bool): if True, values for parameters in openapi_types 118 | will be type checked and a TypeError will be 119 | raised if the wrong type is input. 120 | Defaults to True 121 | _path_to_item (tuple/list): This is a list of keys or values to 122 | drill down to the model in received_data 123 | when deserializing a response 124 | _spec_property_naming (bool): True if the variable names in the input data 125 | are serialized names, as specified in the OpenAPI document. 126 | False if the variable names in the input data 127 | are pythonic names, e.g. snake case (default) 128 | _configuration (Configuration): the instance to use when 129 | deserializing a file_type parameter. 130 | If passed, type conversion is attempted 131 | If omitted no type conversion is done. 132 | _visited_composed_classes (tuple): This stores a tuple of 133 | classes that we have traveled through so that 134 | if we see that class again we will not use its 135 | discriminator again. 136 | When traveling through a discriminator, the 137 | composed schema that is 138 | is traveled through is added to this set. 139 | For example if Animal has a discriminator 140 | petType and we pass in "Dog", and the class Dog 141 | allOf includes Animal, we move through Animal 142 | once using the discriminator, and pick Dog. 143 | Then in Dog, we will make an instance of the 144 | Animal class but this time we won't travel 145 | through its discriminator because we passed in 146 | _visited_composed_classes = (Animal,) 147 | hinweis (str): [optional] # noqa: E501 148 | """ 149 | 150 | _check_type = kwargs.pop("_check_type", True) 151 | _spec_property_naming = kwargs.pop("_spec_property_naming", True) 152 | _path_to_item = kwargs.pop("_path_to_item", ()) 153 | _configuration = kwargs.pop("_configuration", None) 154 | _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 155 | 156 | self = super(OpenApiModel, cls).__new__(cls) 157 | 158 | if args: 159 | for arg in args: 160 | if isinstance(arg, dict): 161 | kwargs.update(arg) 162 | else: 163 | raise ApiTypeError( 164 | "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 165 | % ( 166 | args, 167 | self.__class__.__name__, 168 | ), 169 | path_to_item=_path_to_item, 170 | valid_classes=(self.__class__,), 171 | ) 172 | 173 | self._data_store = {} 174 | self._check_type = _check_type 175 | self._spec_property_naming = _spec_property_naming 176 | self._path_to_item = _path_to_item 177 | self._configuration = _configuration 178 | self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 179 | 180 | self.datum = datum 181 | for var_name, var_value in kwargs.items(): 182 | if ( 183 | var_name not in self.attribute_map 184 | and self._configuration is not None 185 | and self._configuration.discard_unknown_keys 186 | and self.additional_properties_type is None 187 | ): 188 | # discard variable. 189 | continue 190 | setattr(self, var_name, var_value) 191 | return self 192 | 193 | required_properties = set( 194 | [ 195 | "_data_store", 196 | "_check_type", 197 | "_spec_property_naming", 198 | "_path_to_item", 199 | "_configuration", 200 | "_visited_composed_classes", 201 | ] 202 | ) 203 | 204 | @convert_js_args_to_python_args 205 | def __init__(self, datum, *args, **kwargs): # noqa: E501 206 | """Feiertag - a model defined in OpenAPI 207 | 208 | Args: 209 | datum (str): 210 | 211 | Keyword Args: 212 | _check_type (bool): if True, values for parameters in openapi_types 213 | will be type checked and a TypeError will be 214 | raised if the wrong type is input. 215 | Defaults to True 216 | _path_to_item (tuple/list): This is a list of keys or values to 217 | drill down to the model in received_data 218 | when deserializing a response 219 | _spec_property_naming (bool): True if the variable names in the input data 220 | are serialized names, as specified in the OpenAPI document. 221 | False if the variable names in the input data 222 | are pythonic names, e.g. snake case (default) 223 | _configuration (Configuration): the instance to use when 224 | deserializing a file_type parameter. 225 | If passed, type conversion is attempted 226 | If omitted no type conversion is done. 227 | _visited_composed_classes (tuple): This stores a tuple of 228 | classes that we have traveled through so that 229 | if we see that class again we will not use its 230 | discriminator again. 231 | When traveling through a discriminator, the 232 | composed schema that is 233 | is traveled through is added to this set. 234 | For example if Animal has a discriminator 235 | petType and we pass in "Dog", and the class Dog 236 | allOf includes Animal, we move through Animal 237 | once using the discriminator, and pick Dog. 238 | Then in Dog, we will make an instance of the 239 | Animal class but this time we won't travel 240 | through its discriminator because we passed in 241 | _visited_composed_classes = (Animal,) 242 | hinweis (str): [optional] # noqa: E501 243 | """ 244 | 245 | _check_type = kwargs.pop("_check_type", True) 246 | _spec_property_naming = kwargs.pop("_spec_property_naming", False) 247 | _path_to_item = kwargs.pop("_path_to_item", ()) 248 | _configuration = kwargs.pop("_configuration", None) 249 | _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 250 | 251 | if args: 252 | for arg in args: 253 | if isinstance(arg, dict): 254 | kwargs.update(arg) 255 | else: 256 | raise ApiTypeError( 257 | "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 258 | % ( 259 | args, 260 | self.__class__.__name__, 261 | ), 262 | path_to_item=_path_to_item, 263 | valid_classes=(self.__class__,), 264 | ) 265 | 266 | self._data_store = {} 267 | self._check_type = _check_type 268 | self._spec_property_naming = _spec_property_naming 269 | self._path_to_item = _path_to_item 270 | self._configuration = _configuration 271 | self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 272 | 273 | self.datum = datum 274 | for var_name, var_value in kwargs.items(): 275 | if ( 276 | var_name not in self.attribute_map 277 | and self._configuration is not None 278 | and self._configuration.discard_unknown_keys 279 | and self.additional_properties_type is None 280 | ): 281 | # discard variable. 282 | continue 283 | setattr(self, var_name, var_value) 284 | if var_name in self.read_only_vars: 285 | raise ApiAttributeError( 286 | f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 287 | f"class with read only attributes." 288 | ) 289 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/models/__init__.py: -------------------------------------------------------------------------------- 1 | # flake8: noqa 2 | 3 | # import all models into this package 4 | # if you have many models here with many references from one model to another this may 5 | # raise a RecursionError 6 | # to avoid this, import only the models that you directly need like: 7 | # from from deutschland.feiertage.model.pet import Pet 8 | # or import this package, but before doing it, use: 9 | # import sys 10 | # sys.setrecursionlimit(n) 11 | 12 | from deutschland.feiertage.model.feiertag import Feiertag 13 | -------------------------------------------------------------------------------- /python-client/deutschland/feiertage/rest.py: -------------------------------------------------------------------------------- 1 | """ 2 | Feiertage API 3 | 4 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 5 | 6 | The version of the OpenAPI document: 1.0.0 7 | Contact: kontakt@bund.dev 8 | Generated by: https://openapi-generator.tech 9 | """ 10 | 11 | import io 12 | import ipaddress 13 | import json 14 | import logging 15 | import re 16 | import ssl 17 | from urllib.parse import urlencode, urlparse 18 | from urllib.request import proxy_bypass_environment 19 | 20 | import urllib3 21 | from deutschland.feiertage.exceptions import ( 22 | ApiException, 23 | ApiValueError, 24 | ForbiddenException, 25 | NotFoundException, 26 | ServiceException, 27 | UnauthorizedException, 28 | ) 29 | 30 | logger = logging.getLogger(__name__) 31 | 32 | 33 | class RESTResponse(io.IOBase): 34 | 35 | def __init__(self, resp): 36 | self.urllib3_response = resp 37 | self.status = resp.status 38 | self.reason = resp.reason 39 | self.data = resp.data 40 | 41 | def getheaders(self): 42 | """Returns a dictionary of the response headers.""" 43 | return self.urllib3_response.getheaders() 44 | 45 | def getheader(self, name, default=None): 46 | """Returns a given response header.""" 47 | return self.urllib3_response.getheader(name, default) 48 | 49 | 50 | class RESTClientObject(object): 51 | 52 | def __init__(self, configuration, pools_size=4, maxsize=None): 53 | # urllib3.PoolManager will pass all kw parameters to connectionpool 54 | # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 55 | # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 56 | # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 57 | # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 58 | 59 | # cert_reqs 60 | if configuration.verify_ssl: 61 | cert_reqs = ssl.CERT_REQUIRED 62 | else: 63 | cert_reqs = ssl.CERT_NONE 64 | 65 | addition_pool_args = {} 66 | if configuration.assert_hostname is not None: 67 | addition_pool_args["assert_hostname"] = ( 68 | configuration.assert_hostname 69 | ) # noqa: E501 70 | 71 | if configuration.retries is not None: 72 | addition_pool_args["retries"] = configuration.retries 73 | 74 | if configuration.socket_options is not None: 75 | addition_pool_args["socket_options"] = configuration.socket_options 76 | 77 | if maxsize is None: 78 | if configuration.connection_pool_maxsize is not None: 79 | maxsize = configuration.connection_pool_maxsize 80 | else: 81 | maxsize = 4 82 | 83 | # https pool manager 84 | if configuration.proxy and not should_bypass_proxies( 85 | configuration.host, no_proxy=configuration.no_proxy or "" 86 | ): 87 | self.pool_manager = urllib3.ProxyManager( 88 | num_pools=pools_size, 89 | maxsize=maxsize, 90 | cert_reqs=cert_reqs, 91 | ca_certs=configuration.ssl_ca_cert, 92 | cert_file=configuration.cert_file, 93 | key_file=configuration.key_file, 94 | proxy_url=configuration.proxy, 95 | proxy_headers=configuration.proxy_headers, 96 | **addition_pool_args 97 | ) 98 | else: 99 | self.pool_manager = urllib3.PoolManager( 100 | num_pools=pools_size, 101 | maxsize=maxsize, 102 | cert_reqs=cert_reqs, 103 | ca_certs=configuration.ssl_ca_cert, 104 | cert_file=configuration.cert_file, 105 | key_file=configuration.key_file, 106 | **addition_pool_args 107 | ) 108 | 109 | def request( 110 | self, 111 | method, 112 | url, 113 | query_params=None, 114 | headers=None, 115 | body=None, 116 | post_params=None, 117 | _preload_content=True, 118 | _request_timeout=None, 119 | ): 120 | """Perform requests. 121 | 122 | :param method: http request method 123 | :param url: http request url 124 | :param query_params: query parameters in the url 125 | :param headers: http request headers 126 | :param body: request json body, for `application/json` 127 | :param post_params: request post parameters, 128 | `application/x-www-form-urlencoded` 129 | and `multipart/form-data` 130 | :param _preload_content: if False, the urllib3.HTTPResponse object will 131 | be returned without reading/decoding response 132 | data. Default is True. 133 | :param _request_timeout: timeout setting for this request. If one 134 | number provided, it will be total request 135 | timeout. It can also be a pair (tuple) of 136 | (connection, read) timeouts. 137 | """ 138 | method = method.upper() 139 | assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] 140 | 141 | if post_params and body: 142 | raise ApiValueError( 143 | "body parameter cannot be used with post_params parameter." 144 | ) 145 | 146 | post_params = post_params or {} 147 | headers = headers or {} 148 | 149 | timeout = None 150 | if _request_timeout: 151 | if isinstance(_request_timeout, (int, float)): # noqa: E501,F821 152 | timeout = urllib3.Timeout(total=_request_timeout) 153 | elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: 154 | timeout = urllib3.Timeout( 155 | connect=_request_timeout[0], read=_request_timeout[1] 156 | ) 157 | 158 | try: 159 | # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` 160 | if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: 161 | # Only set a default Content-Type for POST, PUT, PATCH and OPTIONS requests 162 | if (method != "DELETE") and ("Content-Type" not in headers): 163 | headers["Content-Type"] = "application/json" 164 | if query_params: 165 | url += "?" + urlencode(query_params) 166 | if ("Content-Type" not in headers) or ( 167 | re.search("json", headers["Content-Type"], re.IGNORECASE) 168 | ): 169 | request_body = None 170 | if body is not None: 171 | request_body = json.dumps(body) 172 | r = self.pool_manager.request( 173 | method, 174 | url, 175 | body=request_body, 176 | preload_content=_preload_content, 177 | timeout=timeout, 178 | headers=headers, 179 | ) 180 | elif ( 181 | headers["Content-Type"] == "application/x-www-form-urlencoded" 182 | ): # noqa: E501 183 | r = self.pool_manager.request( 184 | method, 185 | url, 186 | fields=post_params, 187 | encode_multipart=False, 188 | preload_content=_preload_content, 189 | timeout=timeout, 190 | headers=headers, 191 | ) 192 | elif headers["Content-Type"] == "multipart/form-data": 193 | # must del headers['Content-Type'], or the correct 194 | # Content-Type which generated by urllib3 will be 195 | # overwritten. 196 | del headers["Content-Type"] 197 | r = self.pool_manager.request( 198 | method, 199 | url, 200 | fields=post_params, 201 | encode_multipart=True, 202 | preload_content=_preload_content, 203 | timeout=timeout, 204 | headers=headers, 205 | ) 206 | # Pass a `string` parameter directly in the body to support 207 | # other content types than Json when `body` argument is 208 | # provided in serialized form 209 | elif isinstance(body, str) or isinstance(body, bytes): 210 | request_body = body 211 | r = self.pool_manager.request( 212 | method, 213 | url, 214 | body=request_body, 215 | preload_content=_preload_content, 216 | timeout=timeout, 217 | headers=headers, 218 | ) 219 | else: 220 | # Cannot generate the request from given parameters 221 | msg = """Cannot prepare a request message for provided 222 | arguments. Please check that your arguments match 223 | declared content type.""" 224 | raise ApiException(status=0, reason=msg) 225 | # For `GET`, `HEAD` 226 | else: 227 | r = self.pool_manager.request( 228 | method, 229 | url, 230 | fields=query_params, 231 | preload_content=_preload_content, 232 | timeout=timeout, 233 | headers=headers, 234 | ) 235 | except urllib3.exceptions.SSLError as e: 236 | msg = "{0}\n{1}".format(type(e).__name__, str(e)) 237 | raise ApiException(status=0, reason=msg) 238 | 239 | if _preload_content: 240 | r = RESTResponse(r) 241 | 242 | # log response body 243 | logger.debug("response body: %s", r.data) 244 | 245 | if not 200 <= r.status <= 299: 246 | if r.status == 401: 247 | raise UnauthorizedException(http_resp=r) 248 | 249 | if r.status == 403: 250 | raise ForbiddenException(http_resp=r) 251 | 252 | if r.status == 404: 253 | raise NotFoundException(http_resp=r) 254 | 255 | if 500 <= r.status <= 599: 256 | raise ServiceException(http_resp=r) 257 | 258 | raise ApiException(http_resp=r) 259 | 260 | return r 261 | 262 | def GET( 263 | self, 264 | url, 265 | headers=None, 266 | query_params=None, 267 | _preload_content=True, 268 | _request_timeout=None, 269 | ): 270 | return self.request( 271 | "GET", 272 | url, 273 | headers=headers, 274 | _preload_content=_preload_content, 275 | _request_timeout=_request_timeout, 276 | query_params=query_params, 277 | ) 278 | 279 | def HEAD( 280 | self, 281 | url, 282 | headers=None, 283 | query_params=None, 284 | _preload_content=True, 285 | _request_timeout=None, 286 | ): 287 | return self.request( 288 | "HEAD", 289 | url, 290 | headers=headers, 291 | _preload_content=_preload_content, 292 | _request_timeout=_request_timeout, 293 | query_params=query_params, 294 | ) 295 | 296 | def OPTIONS( 297 | self, 298 | url, 299 | headers=None, 300 | query_params=None, 301 | post_params=None, 302 | body=None, 303 | _preload_content=True, 304 | _request_timeout=None, 305 | ): 306 | return self.request( 307 | "OPTIONS", 308 | url, 309 | headers=headers, 310 | query_params=query_params, 311 | post_params=post_params, 312 | _preload_content=_preload_content, 313 | _request_timeout=_request_timeout, 314 | body=body, 315 | ) 316 | 317 | def DELETE( 318 | self, 319 | url, 320 | headers=None, 321 | query_params=None, 322 | body=None, 323 | _preload_content=True, 324 | _request_timeout=None, 325 | ): 326 | return self.request( 327 | "DELETE", 328 | url, 329 | headers=headers, 330 | query_params=query_params, 331 | _preload_content=_preload_content, 332 | _request_timeout=_request_timeout, 333 | body=body, 334 | ) 335 | 336 | def POST( 337 | self, 338 | url, 339 | headers=None, 340 | query_params=None, 341 | post_params=None, 342 | body=None, 343 | _preload_content=True, 344 | _request_timeout=None, 345 | ): 346 | return self.request( 347 | "POST", 348 | url, 349 | headers=headers, 350 | query_params=query_params, 351 | post_params=post_params, 352 | _preload_content=_preload_content, 353 | _request_timeout=_request_timeout, 354 | body=body, 355 | ) 356 | 357 | def PUT( 358 | self, 359 | url, 360 | headers=None, 361 | query_params=None, 362 | post_params=None, 363 | body=None, 364 | _preload_content=True, 365 | _request_timeout=None, 366 | ): 367 | return self.request( 368 | "PUT", 369 | url, 370 | headers=headers, 371 | query_params=query_params, 372 | post_params=post_params, 373 | _preload_content=_preload_content, 374 | _request_timeout=_request_timeout, 375 | body=body, 376 | ) 377 | 378 | def PATCH( 379 | self, 380 | url, 381 | headers=None, 382 | query_params=None, 383 | post_params=None, 384 | body=None, 385 | _preload_content=True, 386 | _request_timeout=None, 387 | ): 388 | return self.request( 389 | "PATCH", 390 | url, 391 | headers=headers, 392 | query_params=query_params, 393 | post_params=post_params, 394 | _preload_content=_preload_content, 395 | _request_timeout=_request_timeout, 396 | body=body, 397 | ) 398 | 399 | 400 | # end of class RESTClientObject 401 | 402 | 403 | def is_ipv4(target): 404 | """Test if IPv4 address or not""" 405 | try: 406 | chk = ipaddress.IPv4Address(target) 407 | return True 408 | except ipaddress.AddressValueError: 409 | return False 410 | 411 | 412 | def in_ipv4net(target, net): 413 | """Test if target belongs to given IPv4 network""" 414 | try: 415 | nw = ipaddress.IPv4Network(net) 416 | ip = ipaddress.IPv4Address(target) 417 | if ip in nw: 418 | return True 419 | return False 420 | except ipaddress.AddressValueError: 421 | return False 422 | except ipaddress.NetmaskValueError: 423 | return False 424 | 425 | 426 | def should_bypass_proxies(url, no_proxy=None): 427 | """Yet another requests.should_bypass_proxies 428 | Test if proxies should not be used for a particular url. 429 | """ 430 | 431 | parsed = urlparse(url) 432 | 433 | # special cases 434 | if parsed.hostname in [None, ""]: 435 | return True 436 | 437 | # special cases 438 | if no_proxy in [None, ""]: 439 | return False 440 | if no_proxy == "*": 441 | return True 442 | 443 | no_proxy = no_proxy.lower().replace(" ", "") 444 | entries = (host for host in no_proxy.split(",") if host) 445 | 446 | if is_ipv4(parsed.hostname): 447 | for item in entries: 448 | if in_ipv4net(parsed.hostname, item): 449 | return True 450 | return proxy_bypass_environment(parsed.hostname, {"no": no_proxy}) 451 | -------------------------------------------------------------------------------- /python-client/docs/DefaultApi.md: -------------------------------------------------------------------------------- 1 | # feiertage.DefaultApi 2 | 3 | All URIs are relative to *https://feiertage-api.de/api* 4 | 5 | Method | HTTP request | Description 6 | ------------- | ------------- | ------------- 7 | [**get_feiertage**](DefaultApi.md#get_feiertage) | **GET** / | Get Feiertage 8 | 9 | 10 | # **get_feiertage** 11 | > {str: (bool, date, datetime, dict, float, int, list, str, none_type)} get_feiertage() 12 | 13 | Get Feiertage 14 | 15 | ### Example 16 | 17 | 18 | ```python 19 | import time 20 | from deutschland import feiertage 21 | from deutschland.feiertage.api import default_api 22 | from pprint import pprint 23 | # Defining the host is optional and defaults to https://feiertage-api.de/api 24 | # See configuration.py for a list of all supported configuration parameters. 25 | configuration = feiertage.Configuration( 26 | host = "https://feiertage-api.de/api" 27 | ) 28 | 29 | 30 | # Enter a context with an instance of the API client 31 | with feiertage.ApiClient() as api_client: 32 | # Create an instance of the API class 33 | api_instance = default_api.DefaultApi(api_client) 34 | jahr = "2021" # str | Welches Jahr? (optional) 35 | nur_land = "NATIONAL" # str | Welches Bundesland? (optional) 36 | nur_daten = 1 # int | Nur Daten oder auch Hinweise? (optional) 37 | 38 | # example passing only required values which don't have defaults set 39 | # and optional values 40 | try: 41 | # Get Feiertage 42 | api_response = api_instance.get_feiertage(jahr=jahr, nur_land=nur_land, nur_daten=nur_daten) 43 | pprint(api_response) 44 | except feiertage.ApiException as e: 45 | print("Exception when calling DefaultApi->get_feiertage: %s\n" % e) 46 | ``` 47 | 48 | 49 | ### Parameters 50 | 51 | Name | Type | Description | Notes 52 | ------------- | ------------- | ------------- | ------------- 53 | **jahr** | **str**| Welches Jahr? | [optional] 54 | **nur_land** | **str**| Welches Bundesland? | [optional] 55 | **nur_daten** | **int**| Nur Daten oder auch Hinweise? | [optional] 56 | 57 | ### Return type 58 | 59 | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** 60 | 61 | ### Authorization 62 | 63 | No authorization required 64 | 65 | ### HTTP request headers 66 | 67 | - **Content-Type**: Not defined 68 | - **Accept**: application/json 69 | 70 | 71 | ### HTTP response details 72 | 73 | | Status code | Description | Response headers | 74 | |-------------|-------------|------------------| 75 | **200** | Feiertage | - | 76 | **0** | unexpected error | - | 77 | 78 | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) 79 | 80 | -------------------------------------------------------------------------------- /python-client/docs/Feiertag.md: -------------------------------------------------------------------------------- 1 | # Feiertag 2 | 3 | 4 | ## Properties 5 | Name | Type | Description | Notes 6 | ------------ | ------------- | ------------- | ------------- 7 | **datum** | **str** | | 8 | **hinweis** | **str** | | [optional] 9 | **any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional] 10 | 11 | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) 12 | 13 | 14 | -------------------------------------------------------------------------------- /python-client/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool] 2 | [tool.poetry] 3 | name = "de-feiertage" 4 | version = "1.0.2" 5 | description = "Feiertage API" 6 | keywords = ["OpenAPI", "OpenAPI-Generator", "feiertage", "App", "API"] 7 | homepage = "https://github.com/bundesAPI/feiertage-api" 8 | authors = ["BundesAPI "] 9 | packages = [ 10 | { include = "deutschland"} 11 | ] 12 | license = "Apache-2.0" 13 | readme = "README.md" 14 | 15 | [tool.poetry.dependencies] 16 | python = ">=3.6" 17 | python-dateutil = "*" 18 | urllib3 = ">=1.25.3" 19 | 20 | [tool.poetry.urls] 21 | "Bug Tracker" = "https://github.com/bundesAPI/feiertage-api/issues" 22 | 23 | [tool.poetry.dev-dependencies] 24 | black = "^21.7b0" 25 | pytest = "^6.2.4" 26 | 27 | 28 | [build-system] 29 | requires = ["poetry-core>=1.0.0"] 30 | build-backend = "poetry.core.masonry.api" 31 | 32 | -------------------------------------------------------------------------------- /python-client/requirements.txt: -------------------------------------------------------------------------------- 1 | python_dateutil >= 2.5.3 2 | setuptools >= 59.0.0 3 | urllib3 >= 1.25.3 4 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/conf.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | sys.path.insert(0, os.path.abspath("../")) 5 | # Configuration file for the Sphinx documentation builder. 6 | # 7 | # For the full list of built-in configuration values, see the documentation: 8 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 9 | 10 | # -- Project information ----------------------------------------------------- 11 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 12 | 13 | project = "feiertage-api" 14 | copyright = "2024, bund.dev" 15 | author = "bund.dev" 16 | 17 | version = "1.0.2" 18 | release = "1.0.2" 19 | 20 | # -- General configuration --------------------------------------------------- 21 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 22 | 23 | extensions = [ 24 | "m2r2", 25 | "sphinx.ext.autodoc", 26 | "sphinx.ext.napoleon", 27 | "sphinx.ext.autosummary", 28 | ] 29 | 30 | templates_path = ["_templates"] 31 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] 32 | 33 | language = "de" 34 | 35 | # -- Options for HTML output ------------------------------------------------- 36 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output 37 | 38 | html_theme = "alabaster" 39 | html_static_path = ["_static"] 40 | 41 | source_extensions = [".rst", ".md"] 42 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/index.rst: -------------------------------------------------------------------------------- 1 | feiertage-api Documentation 2 | =========================== 3 | 4 | .. toctree:: 5 | :glob: 6 | 7 | source/* 8 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/source/feiertage.api.rst: -------------------------------------------------------------------------------- 1 | feiertage.api package 2 | ===================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | feiertage.api.default\_api module 8 | --------------------------------- 9 | 10 | .. automodule:: feiertage.api.default_api 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | Module contents 16 | --------------- 17 | 18 | .. automodule:: feiertage.api 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/source/feiertage.apis.rst: -------------------------------------------------------------------------------- 1 | feiertage.apis package 2 | ====================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: feiertage.apis 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/source/feiertage.model.rst: -------------------------------------------------------------------------------- 1 | feiertage.model package 2 | ======================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | feiertage.model.feiertag module 8 | ------------------------------- 9 | 10 | .. automodule:: feiertage.model.feiertag 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | Module contents 16 | --------------- 17 | 18 | .. automodule:: feiertage.model 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/source/feiertage.models.rst: -------------------------------------------------------------------------------- 1 | feiertage.models package 2 | ======================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: feiertage.models 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/source/feiertage.rst: -------------------------------------------------------------------------------- 1 | feiertage package 2 | ================= 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | :maxdepth: 4 9 | 10 | feiertage.api 11 | feiertage.apis 12 | feiertage.model 13 | feiertage.models 14 | 15 | Submodules 16 | ---------- 17 | 18 | feiertage.api\_client module 19 | ---------------------------- 20 | 21 | .. automodule:: feiertage.api_client 22 | :members: 23 | :undoc-members: 24 | :show-inheritance: 25 | 26 | feiertage.configuration module 27 | ------------------------------ 28 | 29 | .. automodule:: feiertage.configuration 30 | :members: 31 | :undoc-members: 32 | :show-inheritance: 33 | 34 | feiertage.exceptions module 35 | --------------------------- 36 | 37 | .. automodule:: feiertage.exceptions 38 | :members: 39 | :undoc-members: 40 | :show-inheritance: 41 | 42 | feiertage.model\_utils module 43 | ----------------------------- 44 | 45 | .. automodule:: feiertage.model_utils 46 | :members: 47 | :undoc-members: 48 | :show-inheritance: 49 | 50 | feiertage.rest module 51 | --------------------- 52 | 53 | .. automodule:: feiertage.rest 54 | :members: 55 | :undoc-members: 56 | :show-inheritance: 57 | 58 | Module contents 59 | --------------- 60 | 61 | .. automodule:: feiertage 62 | :members: 63 | :undoc-members: 64 | :show-inheritance: 65 | -------------------------------------------------------------------------------- /python-client/sphinx-docs/source/modules.rst: -------------------------------------------------------------------------------- 1 | deutschland 2 | =========== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | 7 | feiertage 8 | -------------------------------------------------------------------------------- /python-client/test-requirements.txt: -------------------------------------------------------------------------------- 1 | pytest-cov>=2.8.1 2 | -------------------------------------------------------------------------------- /python-client/test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bundesAPI/feiertage-api/ceceaab5a9c7b21cb12bca1373625ada33c2800e/python-client/test/__init__.py -------------------------------------------------------------------------------- /python-client/test/test_default_api.py: -------------------------------------------------------------------------------- 1 | """ 2 | Feiertage API 3 | 4 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 5 | 6 | The version of the OpenAPI document: 1.0.0 7 | Contact: kontakt@bund.dev 8 | Generated by: https://openapi-generator.tech 9 | """ 10 | 11 | import unittest 12 | 13 | from deutschland.feiertage.api.default_api import DefaultApi # noqa: E501 14 | 15 | from deutschland import feiertage 16 | 17 | 18 | class TestDefaultApi(unittest.TestCase): 19 | """DefaultApi unit test stubs""" 20 | 21 | def setUp(self): 22 | self.api = DefaultApi() # noqa: E501 23 | 24 | def tearDown(self): 25 | pass 26 | 27 | def test_get_feiertage(self): 28 | """Test case for get_feiertage 29 | 30 | Get Feiertage # noqa: E501 31 | """ 32 | pass 33 | 34 | 35 | if __name__ == "__main__": 36 | unittest.main() 37 | -------------------------------------------------------------------------------- /python-client/test/test_feiertag.py: -------------------------------------------------------------------------------- 1 | """ 2 | Feiertage API 3 | 4 | Deutsche Feiertage per JSON-Webservice (API) # noqa: E501 5 | 6 | The version of the OpenAPI document: 1.0.0 7 | Contact: kontakt@bund.dev 8 | Generated by: https://openapi-generator.tech 9 | """ 10 | 11 | import sys 12 | import unittest 13 | 14 | from deutschland.feiertage.model.feiertag import Feiertag 15 | 16 | from deutschland import feiertage 17 | 18 | 19 | class TestFeiertag(unittest.TestCase): 20 | """Feiertag unit test stubs""" 21 | 22 | def setUp(self): 23 | pass 24 | 25 | def tearDown(self): 26 | pass 27 | 28 | def testFeiertag(self): 29 | """Test Feiertag""" 30 | # FIXME: construct object with mandatory attributes with example values 31 | # model = Feiertag() # noqa: E501 32 | pass 33 | 34 | 35 | if __name__ == "__main__": 36 | unittest.main() 37 | -------------------------------------------------------------------------------- /python-client/tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py3 3 | 4 | [testenv] 5 | deps=-r{toxinidir}/requirements.txt 6 | -r{toxinidir}/test-requirements.txt 7 | 8 | commands= 9 | pytest --cov=feiertage 10 | --------------------------------------------------------------------------------