KRA eTIMS API - Python Client
===============================
A Python wrapper for the KRA eTIMS REST API. Easily interact with the KRA eTIMS REST API using this library.
Installation
------------
.. code-block:: bash
pip install kra_etims
Setup
-----
.. code-block:: python
from kra_etims import API
etimsapi = API(
url="http://localhost:8088",
pin="A123456789Z",
)
Options
~~~~~~~
+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+
| Option | Type | Required | Description |
+=======================+=============+==========+=======================================================================================================+
| ``url`` | ``string`` | yes | Your Server URL, example: http://localhost:8088/ |
+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+
| ``pin`` | ``string`` | yes | Your PIN |
+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+
| ``timeout`` | ``integer`` | no | Connection timeout, default is ``5`` |
+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+
| ``verify_ssl`` | ``bool`` | no | Verify SSL when connect, use this option as ``False`` when need to test with self-signed certificates |
+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+
| ``user_agent`` | ``string`` | no | Set a custom User-Agent, default is ``KRA-eTIMS-Python-REST-API/1.0.0`` |
+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+
Methods
-------
+--------------+----------------+------------------------------------------------------------------+
| Params | Type | Description |
+==============+================+==================================================================+
| ``endpoint`` | ``string`` | KRA eTIMS API endpoint, example: ``customers`` or ``order/12`` |
+--------------+----------------+------------------------------------------------------------------+
| ``data`` | ``dictionary`` | Data that will be converted to JSON |
+--------------+----------------+------------------------------------------------------------------+
| ``**kwargs`` | ``dictionary`` | Accepts ``params``, also other Requests arguments |
+--------------+----------------+------------------------------------------------------------------+
POST
~~~~
- ``.post(endpoint, data, **kwargs)``
Response
--------
All methods will return `Response <http://docs.python-requests.org/en/latest/api/#requests.Response>`_ object.
Example of returned data:
.. code-block:: bash
>>> r = etimsapi.post("/items/selectItems", {
"bhfId":"00",
"lastReqDt":"20160523000000"
})
>>> r.status_code
200
>>> r.headers['content-type']
'application/json; charset=UTF-8'
>>> r.encoding
'UTF-8'
>>> r.text
u'{"resultCd": "000","resultMsg": "Successful","resultDt": "20240816201351","data": {"itemList": [{"tin": "P052350422M",...' // Json text
>>> r.json()
{u'resultCd': u'000',u'resultMsg': u'Successful',u'resultDt': u'20240816201351',u'data': {u'itemList': [{u'tin': u'P052350422M',... // Dictionary data
Changelog
---------
See `CHANGELOG.md <https://github.com/ingenious-dev/kra-etims-api-python/blob/trunk/CHANGELOG.md>`_.
Raw data
{
"_id": null,
"home_page": "https://github.com/ingenious-dev/kra-etims-api-python",
"name": "KRA-eTIMS",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "kra etims rest api",
"author": "Joseph Suhudu @ ingenious.or.ke",
"author_email": "suhudu+joseph@gmail.com",
"download_url": null,
"platform": "any",
"description": "KRA eTIMS API - Python Client\r\n===============================\r\n\r\nA Python wrapper for the KRA eTIMS REST API. Easily interact with the KRA eTIMS REST API using this library.\r\n\r\nInstallation\r\n------------\r\n\r\n.. code-block:: bash\r\n\r\n pip install kra_etims\r\n\r\nSetup\r\n-----\r\n\r\n.. code-block:: python\r\n\r\n from kra_etims import API\r\n\r\n etimsapi = API(\r\n url=\"http://localhost:8088\",\r\n pin=\"A123456789Z\",\r\n )\r\n\r\nOptions\r\n~~~~~~~\r\n\r\n+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+\r\n| Option | Type | Required | Description |\r\n+=======================+=============+==========+=======================================================================================================+\r\n| ``url`` | ``string`` | yes | Your Server URL, example: http://localhost:8088/ |\r\n+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+\r\n| ``pin`` | ``string`` | yes | Your PIN |\r\n+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+\r\n| ``timeout`` | ``integer`` | no | Connection timeout, default is ``5`` |\r\n+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+\r\n| ``verify_ssl`` | ``bool`` | no | Verify SSL when connect, use this option as ``False`` when need to test with self-signed certificates |\r\n+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+\r\n| ``user_agent`` | ``string`` | no | Set a custom User-Agent, default is ``KRA-eTIMS-Python-REST-API/1.0.0`` |\r\n+-----------------------+-------------+----------+-------------------------------------------------------------------------------------------------------+\r\n\r\nMethods\r\n-------\r\n\r\n+--------------+----------------+------------------------------------------------------------------+\r\n| Params | Type | Description |\r\n+==============+================+==================================================================+\r\n| ``endpoint`` | ``string`` | KRA eTIMS API endpoint, example: ``customers`` or ``order/12`` |\r\n+--------------+----------------+------------------------------------------------------------------+\r\n| ``data`` | ``dictionary`` | Data that will be converted to JSON |\r\n+--------------+----------------+------------------------------------------------------------------+\r\n| ``**kwargs`` | ``dictionary`` | Accepts ``params``, also other Requests arguments |\r\n+--------------+----------------+------------------------------------------------------------------+\r\n\r\nPOST\r\n~~~~\r\n\r\n- ``.post(endpoint, data, **kwargs)``\r\n\r\nResponse\r\n--------\r\n\r\nAll methods will return `Response <http://docs.python-requests.org/en/latest/api/#requests.Response>`_ object.\r\n\r\nExample of returned data:\r\n\r\n.. code-block:: bash\r\n\r\n >>> r = etimsapi.post(\"/items/selectItems\", {\r\n \"bhfId\":\"00\",\r\n \"lastReqDt\":\"20160523000000\"\r\n })\r\n >>> r.status_code\r\n 200\r\n >>> r.headers['content-type']\r\n 'application/json; charset=UTF-8'\r\n >>> r.encoding\r\n 'UTF-8'\r\n >>> r.text\r\n u'{\"resultCd\": \"000\",\"resultMsg\": \"Successful\",\"resultDt\": \"20240816201351\",\"data\": {\"itemList\": [{\"tin\": \"P052350422M\",...' // Json text\r\n >>> r.json()\r\n {u'resultCd': u'000',u'resultMsg': u'Successful',u'resultDt': u'20240816201351',u'data': {u'itemList': [{u'tin': u'P052350422M',... // Dictionary data\r\n\r\nChangelog\r\n---------\r\n\r\nSee `CHANGELOG.md <https://github.com/ingenious-dev/kra-etims-api-python/blob/trunk/CHANGELOG.md>`_.\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A Python wrapper for the KRA eTIMS REST API",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/ingenious-dev/kra-etims-api-python",
"Source": "https://github.com/ingenious-dev/kra-etims-api-python",
"Tracker": "https://github.com/ingenious-dev/kra-etims-api-python/issues"
},
"split_keywords": [
"kra",
"etims",
"rest",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "04e8f01208f0adec2cfeaf7a79298ec8e6f84923a14ee20c3c447a08ef156922",
"md5": "50ac62438de513f32cb16224c7591dfc",
"sha256": "889600475397cd84e17359598312046b02aa077a53c68569fa820be3cd226ac5"
},
"downloads": -1,
"filename": "KRA_eTIMS-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "50ac62438de513f32cb16224c7591dfc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4743,
"upload_time": "2024-08-17T17:51:25",
"upload_time_iso_8601": "2024-08-17T17:51:25.794351Z",
"url": "https://files.pythonhosted.org/packages/04/e8/f01208f0adec2cfeaf7a79298ec8e6f84923a14ee20c3c447a08ef156922/KRA_eTIMS-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-17 17:51:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ingenious-dev",
"github_project": "kra-etims-api-python",
"github_not_found": true,
"lcname": "kra-etims"
}