epc-api-python


Nameepc-api-python JSON
Version 1.0.2 PyPI version JSON
download
home_page
SummaryInterface the UK Govenment EPC api
upload_time2023-07-01 14:49:47
maintainer
docs_urlNone
authorKhalim Conn-Kowlessar
requires_python>=3.7
licenseCopyright (c) 2023 Khalim Conn-Kowlessar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords epc_api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            epc-api-python
========================

Simple python client to interface with the EPC data API.

API docs for the domestic api can be found [here](https://epc.opendatacommunities.org/docs/api/domestic)

API docs for the non-domestic api can be found [here](https://epc.opendatacommunities.org/docs/api/non-domestic)

You need to sign up with the EPC api which will provide you with an api key. You need to use
the api key in conjunction with your sign up email address, or with the authorisation
token that you are provided with to access the api

# Installation

This package can be installed by running
```
pip install epc-api-python
```

# Usage
Some usage examples can be found in the `/examples` folder

To set up the api import the `EpcClient` class an initialise the client by tunning

```commandline
import dotenv
from epc_api.client import EpcClient

your_email = "email you signed up with"
api_key = "api you were emailed after sign up"


# I have auth_token in my environment
client = EpcClient(
    user_email=your_email, api_key=your_email_key, version="v1"
)

client.domestic  # interfaces with the domestic url https://epc.opendatacommunities.org/api/<version>/domestic/
client.non_domestic  # interfaces with the non-domestic url https://epc.opendatacommunities.org/api/<version>/non-domestic/
```

There are three main functions that you should use. They are used identically
for both the domestic and non-domestic urls. These are `search`, `certificate` and `recommendations`, which 
access the `/search`, `/certificate` and `/recommendations` urls respectively. Detailed description of these urls
can be found in the api documentation however each of these functions can be used immediately, 
for example

```commandline
search_resp = client.domestic.search()
print(search_resp)

# Test the certificate endpoint
# Use the first lmk_key which is provided as a response from /search
lmk_key = search_resp["rows"][0]["lmk-key"]

certificate_resp = client.domestic.certificate(lmk_key=lmk_key)
print(certificate_resp)

# Test the recommendations endpoint with the same lmk_key
recommendation_resp = client.domestic.recommendations(lmk_key=lmk_key)
print(recommendation_resp)
```

The client can be set up with multiple mime types, with the default value being
`application/json`. If this value is supplied, the json data is parsed and returned in a 
list/dictionary format, however for other mime types, the user is presented the 
content back and it's up to the user to parse the response in a suitable
fashion. Some examples of handling different mime types of have provided in `/examples`.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "epc-api-python",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "epc_api",
    "author": "Khalim Conn-Kowlessar",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/91/c9/192c02e9c301374046e9ddfbac2302f7200a246b5a55c5ff2572027ec4a9/epc-api-python-1.0.2.tar.gz",
    "platform": null,
    "description": "epc-api-python\n========================\n\nSimple python client to interface with the EPC data API.\n\nAPI docs for the domestic api can be found [here](https://epc.opendatacommunities.org/docs/api/domestic)\n\nAPI docs for the non-domestic api can be found [here](https://epc.opendatacommunities.org/docs/api/non-domestic)\n\nYou need to sign up with the EPC api which will provide you with an api key. You need to use\nthe api key in conjunction with your sign up email address, or with the authorisation\ntoken that you are provided with to access the api\n\n# Installation\n\nThis package can be installed by running\n```\npip install epc-api-python\n```\n\n# Usage\nSome usage examples can be found in the `/examples` folder\n\nTo set up the api import the `EpcClient` class an initialise the client by tunning\n\n```commandline\nimport dotenv\nfrom epc_api.client import EpcClient\n\nyour_email = \"email you signed up with\"\napi_key = \"api you were emailed after sign up\"\n\n\n# I have auth_token in my environment\nclient = EpcClient(\n    user_email=your_email, api_key=your_email_key, version=\"v1\"\n)\n\nclient.domestic  # interfaces with the domestic url https://epc.opendatacommunities.org/api/<version>/domestic/\nclient.non_domestic  # interfaces with the non-domestic url https://epc.opendatacommunities.org/api/<version>/non-domestic/\n```\n\nThere are three main functions that you should use. They are used identically\nfor both the domestic and non-domestic urls. These are `search`, `certificate` and `recommendations`, which \naccess the `/search`, `/certificate` and `/recommendations` urls respectively. Detailed description of these urls\ncan be found in the api documentation however each of these functions can be used immediately, \nfor example\n\n```commandline\nsearch_resp = client.domestic.search()\nprint(search_resp)\n\n# Test the certificate endpoint\n# Use the first lmk_key which is provided as a response from /search\nlmk_key = search_resp[\"rows\"][0][\"lmk-key\"]\n\ncertificate_resp = client.domestic.certificate(lmk_key=lmk_key)\nprint(certificate_resp)\n\n# Test the recommendations endpoint with the same lmk_key\nrecommendation_resp = client.domestic.recommendations(lmk_key=lmk_key)\nprint(recommendation_resp)\n```\n\nThe client can be set up with multiple mime types, with the default value being\n`application/json`. If this value is supplied, the json data is parsed and returned in a \nlist/dictionary format, however for other mime types, the user is presented the \ncontent back and it's up to the user to parse the response in a suitable\nfashion. Some examples of handling different mime types of have provided in `/examples`.\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2023 Khalim Conn-Kowlessar  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Interface the UK Govenment EPC api",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/KhalimCK/epc-api-python"
    },
    "split_keywords": [
        "epc_api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d734dce477398c2e7cf08d8892ae965e6614109b400cef28560d720bf7a53523",
                "md5": "928fa977b1ea66a316b90f66331d6f6a",
                "sha256": "c2a04dad7b8adbafb87ed70ad670e3e384c6b69a026d38409460033e2b075712"
            },
            "downloads": -1,
            "filename": "epc_api_python-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "928fa977b1ea66a316b90f66331d6f6a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7892,
            "upload_time": "2023-07-01T14:49:46",
            "upload_time_iso_8601": "2023-07-01T14:49:46.105250Z",
            "url": "https://files.pythonhosted.org/packages/d7/34/dce477398c2e7cf08d8892ae965e6614109b400cef28560d720bf7a53523/epc_api_python-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91c9192c02e9c301374046e9ddfbac2302f7200a246b5a55c5ff2572027ec4a9",
                "md5": "d6988f2067bd4c8aabca2e229119e289",
                "sha256": "b73f1f5ac88ecf9f91b86032161738024269c8bf20335f1f396614d8ab48ce19"
            },
            "downloads": -1,
            "filename": "epc-api-python-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d6988f2067bd4c8aabca2e229119e289",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12693,
            "upload_time": "2023-07-01T14:49:47",
            "upload_time_iso_8601": "2023-07-01T14:49:47.652785Z",
            "url": "https://files.pythonhosted.org/packages/91/c9/192c02e9c301374046e9ddfbac2302f7200a246b5a55c5ff2572027ec4a9/epc-api-python-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-01 14:49:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KhalimCK",
    "github_project": "epc-api-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "epc-api-python"
}
        
Elapsed time: 0.93859s