eheso-api-client


Nameeheso-api-client JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryEHESO API
upload_time2024-12-18 14:01:15
maintainerNone
docs_urlNone
authorOpenAPI Generator community
requires_pythonNone
licenseNone
keywords openapi openapi-generator eheso api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # EHESO API Client for Python

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: v1
- Generator version: 7.7.0
- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen

## Requirements.

Python 3.7+

# Installation & Usage
## pip install

```sh
pip install eheso-api-client
```

## Post-Installation Setup
After installing the package, you need to create a .env file in the source folder containing the API key for server access.

**Steps to Create the `.env` File:**
1. Navigate to the folder where the package is installed or the source folder of your project.
2. Create a file named `.env`.
3. Add the following line to the `.env` file:

```env
API_KEY="your_api_key_here"
```
Replace `your_api_key_here` with the actual API key provided to you.

For example:
```env
API_KEY="abcd1234efgh5678ijkl"
```
Save the `.env` file.

#### Note
- The package uses the `.env` file to securely load the API key into the application.
- Please make sure the .env file is not included in version control systems like Git (add .env to your .gitignore).

# Getting Started

The following section provides examples for the most important endpoints:

## Get All Layer Data

Retrieve all the data from a specified layer in the requested format.

For details regarding the parameters and response samples please refer to the documentation: [Get All Layer Data](https://dev.observatory.eter-project.com/api-doc/#tag/Layer-Data/operation/layerQueryGet).

```python

import json
import time
import os
import eheso_api_client
from eheso_api_client.models.format import Format
from eheso_api_client.rest import ApiException
from pprint import pprint

# See configuration.py for a list of all supported configuration parameters.
configuration = eheso_api_client.Configuration(
    host = 'https://dev.observatory.eter-project.com/api/v1'
)

# Configure API key authorization: ApiKeyAuth
configuration.api_key['ApiKeyAuth'] = os.environ['API_KEY']


# Enter a context with an instance of the API client
with eheso_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = eheso_api_client.LayerDataApi(api_client)
    layer_id = 'COUNTRY' # str | The ID of the layer
    format = 'flat' # Format | 

    try:
        # Get All Layer Data
        api_response = api_instance.layer_query_get(layer_id, format)
        print('The response of LayerDataApi->layer_query_get:\n')
        pprint(api_response)

        # save as json file
        with open('data.json', 'w', encoding='utf-8') as f:
            json.dump(api_response, f, ensure_ascii=False, indent=4)
    except Exception as e:
        print('Exception when calling LayerDataApi->layer_query_get: %s\n' % e)
 
```

## Query Layer Data
Retrieve data from a specified layer based on the provided parameters. This endpoint allows querying the layer for specific data, applying filters, and returning the results in the requested format.

For details regarding the parameters and response samples please refer to the documentation: [Query Layer Data](https://dev.observatory.eter-project.com/api-doc/#tag/Layer-Data/operation/layerQueryPost).

```python
import time
import os
import eheso_api_client
from eheso_api_client.models.query_post_schema import QueryPostSchema
from eheso_api_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://dev.observatory.eter-project.com/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = eheso_api_client.Configuration(
    host = "https://dev.observatory.eter-project.com/api/v1"
)


# Configure API key authorization: ApiKeyAuth
configuration.api_key["ApiKeyAuth"] = os.environ["API_KEY"]


# Enter a context with an instance of the API client
with eheso_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = eheso_api_client.LayerDataApi(api_client)
    layer_id = "COUNTRY" # str | The ID of the layer
    query_post_schema = {
        "format":"flat",
        "find": {
            "CY.COUNTRY.v": "AD", 
            "CY.YEAR.v": 2015
        },
        "limit":1,
        "select": [  ],
        "sort": {  }
        } # QueryPostSchema | 

    try:
        # Query Layer Data
        api_response = api_instance.layer_query_post(layer_id, query_post_schema)
        print("The response of LayerDataApi->layer_query_post:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling LayerDataApi->layer_query_post: %s\n" % e)
```

## Get Minimal Field Information
Retreive metadata for each field such as field type, name, category, and definition.

For details regarding the parameters and response samples please refer to the documentation: [Query Layer Data](https://dev.observatory.eter-project.com/api-doc/#tag/Layer-Info).

```python
import time
import os
import eheso_api_client
from eheso_api_client.models.field_info_response_inner import FieldInfoResponseInner
from eheso_api_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://dev.observatory.eter-project.com/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = eheso_api_client.Configuration(
    host = "https://dev.observatory.eter-project.com/api/v1"
)

# Configure API key authorization: ApiKeyAuth
configuration.api_key["ApiKeyAuth"] = os.environ["API_KEY"]

# Enter a context with an instance of the API client
with eheso_api_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = eheso_api_client.LayerInfoApi(api_client)
    layer_id = "COUNTRY" # str | The ID of the layer

    try:
        # Get field information
        api_response = api_instance.field_get(layer_id)
        print("The response of LayerInfoApi->field_get:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling LayerInfoApi->field_get: %s\n" % e)
```

# License
This project is licensed under the MIT License.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "eheso-api-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "OpenAPI, OpenAPI-Generator, EHESO API",
    "author": "OpenAPI Generator community",
    "author_email": "team@openapitools.org",
    "download_url": "https://files.pythonhosted.org/packages/b7/e1/4b3e78e330c58aeb77f65a0d6ace3dad77b48dd5673e0264e2c3a5c75676/eheso_api_client-0.2.1.tar.gz",
    "platform": null,
    "description": "# EHESO API Client for Python\n\nThis Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:\n\n- API version: v1\n- Generator version: 7.7.0\n- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen\n\n## Requirements.\n\nPython 3.7+\n\n# Installation & Usage\n## pip install\n\n```sh\npip install eheso-api-client\n```\n\n## Post-Installation Setup\nAfter installing the package, you need to create a .env file in the source folder containing the API key for server access.\n\n**Steps to Create the `.env` File:**\n1. Navigate to the folder where the package is installed or the source folder of your project.\n2. Create a file named `.env`.\n3. Add the following line to the `.env` file:\n\n```env\nAPI_KEY=\"your_api_key_here\"\n```\nReplace `your_api_key_here` with the actual API key provided to you.\n\nFor example:\n```env\nAPI_KEY=\"abcd1234efgh5678ijkl\"\n```\nSave the `.env` file.\n\n#### Note\n- The package uses the `.env` file to securely load the API key into the application.\n- Please make sure the .env file is not included in version control systems like Git (add .env to your .gitignore).\n\n# Getting Started\n\nThe following section provides examples for the most important endpoints:\n\n## Get All Layer Data\n\nRetrieve all the data from a specified layer in the requested format.\n\nFor details regarding the parameters and response samples please refer to the documentation: [Get All Layer Data](https://dev.observatory.eter-project.com/api-doc/#tag/Layer-Data/operation/layerQueryGet).\n\n```python\n\nimport json\nimport time\nimport os\nimport eheso_api_client\nfrom eheso_api_client.models.format import Format\nfrom eheso_api_client.rest import ApiException\nfrom pprint import pprint\n\n# See configuration.py for a list of all supported configuration parameters.\nconfiguration = eheso_api_client.Configuration(\n    host = 'https://dev.observatory.eter-project.com/api/v1'\n)\n\n# Configure API key authorization: ApiKeyAuth\nconfiguration.api_key['ApiKeyAuth'] = os.environ['API_KEY']\n\n\n# Enter a context with an instance of the API client\nwith eheso_api_client.ApiClient(configuration) as api_client:\n    # Create an instance of the API class\n    api_instance = eheso_api_client.LayerDataApi(api_client)\n    layer_id = 'COUNTRY' # str | The ID of the layer\n    format = 'flat' # Format | \n\n    try:\n        # Get All Layer Data\n        api_response = api_instance.layer_query_get(layer_id, format)\n        print('The response of LayerDataApi->layer_query_get:\\n')\n        pprint(api_response)\n\n        # save as json file\n        with open('data.json', 'w', encoding='utf-8') as f:\n            json.dump(api_response, f, ensure_ascii=False, indent=4)\n    except Exception as e:\n        print('Exception when calling LayerDataApi->layer_query_get: %s\\n' % e)\n \n```\n\n## Query Layer Data\nRetrieve data from a specified layer based on the provided parameters. This endpoint allows querying the layer for specific data, applying filters, and returning the results in the requested format.\n\nFor details regarding the parameters and response samples please refer to the documentation: [Query Layer Data](https://dev.observatory.eter-project.com/api-doc/#tag/Layer-Data/operation/layerQueryPost).\n\n```python\nimport time\nimport os\nimport eheso_api_client\nfrom eheso_api_client.models.query_post_schema import QueryPostSchema\nfrom eheso_api_client.rest import ApiException\nfrom pprint import pprint\n\n# Defining the host is optional and defaults to https://dev.observatory.eter-project.com/api/v1\n# See configuration.py for a list of all supported configuration parameters.\nconfiguration = eheso_api_client.Configuration(\n    host = \"https://dev.observatory.eter-project.com/api/v1\"\n)\n\n\n# Configure API key authorization: ApiKeyAuth\nconfiguration.api_key[\"ApiKeyAuth\"] = os.environ[\"API_KEY\"]\n\n\n# Enter a context with an instance of the API client\nwith eheso_api_client.ApiClient(configuration) as api_client:\n    # Create an instance of the API class\n    api_instance = eheso_api_client.LayerDataApi(api_client)\n    layer_id = \"COUNTRY\" # str | The ID of the layer\n    query_post_schema = {\n        \"format\":\"flat\",\n        \"find\": {\n            \"CY.COUNTRY.v\": \"AD\", \n            \"CY.YEAR.v\": 2015\n        },\n        \"limit\":1,\n        \"select\": [  ],\n        \"sort\": {  }\n        } # QueryPostSchema | \n\n    try:\n        # Query Layer Data\n        api_response = api_instance.layer_query_post(layer_id, query_post_schema)\n        print(\"The response of LayerDataApi->layer_query_post:\\n\")\n        pprint(api_response)\n    except Exception as e:\n        print(\"Exception when calling LayerDataApi->layer_query_post: %s\\n\" % e)\n```\n\n## Get Minimal Field Information\nRetreive metadata for each field such as field type, name, category, and definition.\n\nFor details regarding the parameters and response samples please refer to the documentation: [Query Layer Data](https://dev.observatory.eter-project.com/api-doc/#tag/Layer-Info).\n\n```python\nimport time\nimport os\nimport eheso_api_client\nfrom eheso_api_client.models.field_info_response_inner import FieldInfoResponseInner\nfrom eheso_api_client.rest import ApiException\nfrom pprint import pprint\n\n# Defining the host is optional and defaults to https://dev.observatory.eter-project.com/api/v1\n# See configuration.py for a list of all supported configuration parameters.\nconfiguration = eheso_api_client.Configuration(\n    host = \"https://dev.observatory.eter-project.com/api/v1\"\n)\n\n# Configure API key authorization: ApiKeyAuth\nconfiguration.api_key[\"ApiKeyAuth\"] = os.environ[\"API_KEY\"]\n\n# Enter a context with an instance of the API client\nwith eheso_api_client.ApiClient(configuration) as api_client:\n    # Create an instance of the API class\n    api_instance = eheso_api_client.LayerInfoApi(api_client)\n    layer_id = \"COUNTRY\" # str | The ID of the layer\n\n    try:\n        # Get field information\n        api_response = api_instance.field_get(layer_id)\n        print(\"The response of LayerInfoApi->field_get:\\n\")\n        pprint(api_response)\n    except Exception as e:\n        print(\"Exception when calling LayerInfoApi->field_get: %s\\n\" % e)\n```\n\n# License\nThis project is licensed under the MIT License.\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "EHESO API",
    "version": "0.2.1",
    "project_urls": null,
    "split_keywords": [
        "openapi",
        " openapi-generator",
        " eheso api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d7c743ab647aa483c6f654c0399554742d717fb7be66dac67d8cc86892c2bf28",
                "md5": "c61589f67455f599f6badfaf48097271",
                "sha256": "a28cc30e390e67bb0ca2642cfee079f040871bc051e1178ed82320ae96ab7366"
            },
            "downloads": -1,
            "filename": "eheso_api_client-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c61589f67455f599f6badfaf48097271",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 51445,
            "upload_time": "2024-12-18T14:01:13",
            "upload_time_iso_8601": "2024-12-18T14:01:13.779545Z",
            "url": "https://files.pythonhosted.org/packages/d7/c7/43ab647aa483c6f654c0399554742d717fb7be66dac67d8cc86892c2bf28/eheso_api_client-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7e14b3e78e330c58aeb77f65a0d6ace3dad77b48dd5673e0264e2c3a5c75676",
                "md5": "42dc8166246b394582495a2d90765c28",
                "sha256": "f0cabdcae4991bcd4aef8a0992cbac6e5f6bdd81e35a330249693cde0e7aa747"
            },
            "downloads": -1,
            "filename": "eheso_api_client-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "42dc8166246b394582495a2d90765c28",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 36384,
            "upload_time": "2024-12-18T14:01:15",
            "upload_time_iso_8601": "2024-12-18T14:01:15.816197Z",
            "url": "https://files.pythonhosted.org/packages/b7/e1/4b3e78e330c58aeb77f65a0d6ace3dad77b48dd5673e0264e2c3a5c75676/eheso_api_client-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-18 14:01:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "eheso-api-client"
}
        
Elapsed time: 1.02719s