{
"info": {
"author": "Postmen",
"author_email": "support@postmen.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Software Development"
],
"description": "Introduction\n------------\n\nPython SDK for `Postmen API `__. For problems\nand suggestions please open `GitHub\nissue `__\n\n**Table of Contents**\n\n- `Installation <#installation>`__\n- `Quick Start <#quick-start>`__\n- `class Postmen <#class-postmen>`__\n\n - `Postmen(api_key, region, **kwargs) <#postmenapi_key-region-kwargs>`__\n - `create(self, resource, payload, **kwargs) <#createself-resource-payload-kwargs>`__\n - `get(self, resource, id_=None, **kwargs) <#getself-resource-id_none-kwargs>`__\n - `getError() <#geterror>`__\n - `GET(self, path, **kwargs) <#getself-path-kwargs>`__\n - `POST(self, path, **kwargs) <#postself-path-kwargs>`__\n - `PUT(self, path, **kwargs) <#putself-path-kwargs>`__\n - `DELETE(self, path, **kwargs) <#deleteself-path-kwargs>`__\n\n- `Error Handling <#error-handling>`__\n\n - `class PostmenException <#class-postmenexception>`__\n - `Automatic retry on retryable\n error <#automatic-retry-on-retryable-error>`__\n\n- `Examples <#examples>`__\n\n - `Full list <#full-list>`__\n - `How to run <#how-to-run>`__\n - `Navigation table <#navigation-table>`__\n\n- `Testing <#testing>`__\n- `License <#license>`__\n- `Contributors <#contributors>`__\n\nInstallation\n------------\n\nManual\n^^^^^^\n\nDownload or clone this repo, then run\n\n``python setup.py install``\n\nPyPI\n^^^^\n\nRun ``pip install postmen``\n\nQuick Start\n-----------\n\nIn order to get API key and choose a region refer to the\n`documentation `__.\n\n.. code:: python\n\n import pprint\n\n pp = pprint.PrettyPrinter(indent=4)\n\n from postmen import Postmen, PostmenException\n\n api_key = 'YOUR_API_KEY'\n region = 'sandbox'\n\n # create Postmen API handler object\n\n api = Postmen(api_key, region)\n\n try:\n # as an example we request all the labels\n\n result = api.get('labels')\n print(\"RESULT:\")\n pp.pprint(result)\n except PostmenException as e:\n # if error occurs we can access all\n # the details in following way\n\n print(\"ERROR\")\n print(e.code()) # error code\n print(e.message()) # error message\n pp.pprint(e.details()) # details\n\nclass Postmen\n-------------\n\nPostmen(api\\_key, region, \\*\\*kwargs)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nInitiate Postmen SDK object. In order to get API key and choose a region\nrefer to the `documentation `__.\n\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| Argument | Required | Type | Default | Description |\n+==================+=====================+============+==========+=================================================================================+\n| ``api_key`` | YES | String | N / A | API key |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| ``region`` | NO if ``endpoint`` | String | N / A | API region (``sandbox``, |\n| | is set | | | ``production``) |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| ``endpoint`` | \u2014 | String | N / A | Custom URL API endpoint |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| ``retry`` | \u2014 | Boolean | ``True`` | Automatic retry on retryable errors |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| ``rate`` | \u2014 | Boolean | ``True`` | Wait before API call if |\n| | | | | rate limit exceeded or |\n| | | | | retry on 429 error |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| ``safe`` | \u2014 | Boolean | ``False``| Suppress exceptions on |\n| | | | | errors, None would be |\n| | | | | returned instead, check |\n| | | | | `Error Handling <#error-handling>`__ |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| ``raw`` | \u2014 | Boolean | ``False``| To return API response as a raw string |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| ``proxy`` | \u2014 | Dictionary | ``{}`` | Proxy credentials, |\n| | | | | handled as in `requests |\n| | | | | library `__ |\n| | | | | |\n| | | | | |\n| | | | | |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n| ``time`` | \u2014 | Boolean | ``False``| Convert ISO time strings |\n| | | | | into |\n| | | | | `datetime `__ |\n| | | | | objects |\n+------------------+---------------------+------------+----------+---------------------------------------------------------------------------------+\n\n\n\ncreate(self, resource, payload, \\*\\*kwargs)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nCreates API ``resource`` object, returns new object payload as\n``Dictionary``.\n\n+--------------+---------+-------------+---------+---------------------------------------------------+\n| Argument | Required| Type | Default | Description |\n| | | | | |\n+==============+=========+=============+=========+===================================================+\n| ``resource`` | YES | String | N / A | Postmen API resourse ('rates', |\n| | | | | 'labels', 'manifests') |\n+--------------+---------+-------------+---------+---------------------------------------------------+\n| ``payload`` | YES | Array or | N / A | Payload according to API |\n| | | String | | |\n+--------------+---------+-------------+---------+---------------------------------------------------+\n| ``**kwargs`` | NO | Named | N / A | Override constructor |\n| | | arguments | | `config <#postmenapi_key-region-kwargs>`__ |\n+--------------+---------+-------------+---------+---------------------------------------------------+\n\n**API Docs:**\n\n- `POST /rates `__\n- `POST /labels `__\n- `POST /manifests `__\n- `POST /cancel-labels `__\n\n**Examples:**\n\n- `rates\\_create.py `__\n- `labels\\_create.py `__\n- `manifests\\_create.py `__\n- `cancel\\_labels\\_create.py `__\n\nget(self, resource, id\\_=None, \\*\\*kwargs)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nGets API ``$resource`` objects (list or a single objects).\n\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| Argument | Required| Type | Default | Description |\n| | | | | |\n+==============+=========+================+=========+===================================================+\n| ``resource`` | YES | String | N / A | Postmen API resourse ('rates', |\n| | | | | 'labels', 'manifests') |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| ``id`` | NO | String | ``None``| Object ID, if not set 'list all' API |\n| | | | | method is used |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| ``query`` | NO | Dictionary or | N / A | HTTP GET query (named argument) |\n| | | String | | |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| ``**kwargs`` | NO | Named | N / A | Override constructor |\n| | | arguments | | `config <#postmenapi_key-region-kwargs>`__ |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n\n**API Docs:**\n\n- `GET /rates `__\n- `GET /rates/:id `__\n- `GET /labels `__\n- `GET /labels/:id `__\n- `GET /manifests `__\n- `GET /manifests/:id `__\n- `GET /cancel-labels `__\n- `GET /cancel-labels/:id `__\n\n**Examples:**\n\n- `rates\\_retrieve.py `__\n- `labels\\_retrieve.py `__\n- `manifests\\_retrieve.py `__\n- `cancel\\_labels\\_retrieve.py `__\n\ngetError()\n^^^^^^^^^^\n\nReturns SDK error, `PostmenException type <#class-postmenexception>`__\nif named argument ``safe = True`` was set.\n\nCheck `Error Handling <#error-handling>`__ for details.\n\nGET(self, path, \\*\\*kwargs)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPerforms HTTP GET request, returns an ``Dictionary`` object holding API\nresponse.\n\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| Argument | Required| Type | Default | Description |\n| | | | | |\n+==============+=========+================+=========+===================================================+\n| ``path`` | YES | String | N / A | URL path (e.g. 'v3/labels' for |\n| | | | | ``https://sandbox-api.postmen.com/v3/labels``) |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| ``query`` | NO | Dictionary or | N / A | HTTP GET query (named argument) |\n| | | String | | |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| ``**kwargs`` | NO | Named | ``array | ``query``, and other values |\n| | | arguments | ()`` | overriding constructor |\n| | | | | `config <#postmenapi_key-region-kwargs>`__ |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n\nPOST(self, path, \\*\\*kwargs)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nPUT(self, path, \\*\\*kwargs)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\nDELETE(self, path, \\*\\*kwargs)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPerforms HTTP POST/PUT/DELETE request, returns a ``Dictionary`` object\nholding API response.\n\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| Argument | Required| Type | Default | Description |\n| | | | | |\n+==============+=========+================+=========+===================================================+\n| ``path`` | YES | String | N / A | URL path (e.g. 'v3/labels' for |\n| | | | | ``https://sandbox-api.postmen.com/v3/labels``) |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| ``body`` | NO | Dictionary or | N / A | HTTP POST/PUT/DELETE request body |\n| | | String | | (named argument) |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n| ``**kwargs`` | NO | Named | N / A | Override constructor |\n| | | arguments | | `config <#postmenapi_key-region-kwargs>`__ |\n| | | | | |\n+--------------+---------+----------------+---------+---------------------------------------------------+\n\nError Handling\n--------------\n\nParticular error details are listed in the\n`documentation `__.\n\nAll SDK methods may throw an exception described below.\n\nclass PostmenException\n^^^^^^^^^^^^^^^^^^^^^^\n\n+------------+-----------+------------------------------------------------------+\n| Method | Return | Description |\n| | type | |\n+============+===========+======================================================+\n| code() | Integer | Error code |\n+------------+-----------+------------------------------------------------------+\n| retryable( | Boolean | Indicates if error is retryable |\n| ) | | |\n+------------+-----------+------------------------------------------------------+\n| message() | String | Error message (e.g. |\n| | | ``The request was invalid or cannot be otherwise ser |\n| | | ved``) |\n+------------+-----------+------------------------------------------------------+\n| details() | List | Error details (e.g. |\n| | | ``Destination country must be RUS or KAZ``) |\n+------------+-----------+------------------------------------------------------+\n\nIn case of ``safe = True`` SDK would not throw exceptions,\n`getError() <#geterror>`__ must be used instead.\n\nExample:\n`error.py `__\n\nAutomatic retry on retryable error\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf API error is retryable, SDK will wait for delay and retry. Delay\nstarts from 1 second. After each try, delay time is doubled. Maximum\nnumber of attempts is 5.\n\nTo disable this option set ``retry = False``\n\nExamples\n--------\n\nFull list\n^^^^^^^^^\n\nAll examples avalible listed in the table below.\n\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| File | Description |\n+==================================================================================================================================+========================================+\n| `rates\\_create.py `__ | ``rates`` object creation |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `rates\\_retrieve.py `__ | ``rates`` object(s) retrieve |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `labels\\_create.py `__ | ``labels`` object creation |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `labels\\_retrieve.py `__ | ``labels`` object(s) retrieve |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `manifests\\_create.py `__ | ``manifests`` object creation |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `manifests\\_retrieve.py `__ | ``manifests`` object(s) retrieve |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `cancel\\_labels\\_create.py `__ | ``cancel-labels`` object creation |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `cancel\\_labels\\_retrieve.py `__ | ``cancel-labels`` object(s) retrieve |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `proxy.py `__ | Proxy usage |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n| `error.py `__ | Avalible ways to catch/get errors |\n+----------------------------------------------------------------------------------------------------------------------------------+----------------------------------------+\n\nHow to run\n^^^^^^^^^^\n\nDownload the source code, go to ``examples`` directory.\n\nIf you already installed Postmen SDK for Python you can proceed,\notherwise install it by running ``python setup.py install`` or using\nPyPI.\n\nPut your API key and region to\n`credentials.py `__\n\nCheck the file you want to run before run. Some require you to set\nadditional variables.\n\nNavigation table\n^^^^^^^^^^^^^^^^\n\nFor each API method SDK provides Python wrapper. Use the table below to\nfind SDK method and example that match your need.\n\n+-----------------+-----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+\n| Model \\\\ Action | create | get all | get by id |\n+-----------------+-----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+\n| rates | `.create('rates', payload) `__ | `.get('rates') `__ | `.get('rates', id) `__ |\n+-----------------+-----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+\n| labels | `.create('labels', payload) `__ | `.get('labels') `__ | `.get('labels', id) `__ |\n+-----------------+-----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+\n| manifests | `.create('manifests', payload) `__ | `.get('manifests') `__ | `.get('manifests', id) `__ |\n+-----------------+-----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+\n| cancel-labels | `.create('cancel-labels', payload) `__| `.get('cancel-labels') `__ | `.get('cancel-labels', id) `__ |\n+-----------------+-----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------+\n\nTesting\n-------\n\nIf you contribute to SDK, run automated test before you make pull\nrequest. ::\n\n pip install -r requirements.txt\n python setup.py test\n\nLicense\n-------\n\nReleased under the MIT license. See the LICENSE file for details.\n\nContributors\n------------\n\n- Fedor Korshunov - `view\n contributions `__\n- Marek Narozniak - `view\n contributions `__\n",
"description_content_type": null,
"docs_url": null,
"download_url": "https://github.com/postmen/sdk-python/tarball/1.2",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/postmen/sdk-python",
"keywords": "postmen api binding post mail airmail logistics shipping label rate rates",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "postmen",
"package_url": "https://pypi.org/project/postmen/",
"platform": "",
"project_url": "https://pypi.org/project/postmen/",
"project_urls": {
"Download": "https://github.com/postmen/sdk-python/tarball/1.2",
"Homepage": "https://github.com/postmen/sdk-python"
},
"release_url": "https://pypi.org/project/postmen/1.2/",
"requires_dist": null,
"requires_python": "",
"summary": "Python SDK of Postmen API",
"version": "1.2"
},
"last_serial": 3411953,
"releases": {
"0.1": [],
"0.3": [
{
"comment_text": "",
"digests": {
"md5": "1c8a4fe5c33e8d1cab37ed72b0a1ebb6",
"sha256": "c1346c6bfb0b67a5ddd0f47e5399eefd8c13a1ba289541fd47cce37acdebf669"
},
"downloads": -1,
"filename": "postmen-0.3.tar.gz",
"has_sig": false,
"md5_digest": "1c8a4fe5c33e8d1cab37ed72b0a1ebb6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7030,
"upload_time": "2015-07-15T04:38:05",
"url": "https://files.pythonhosted.org/packages/67/be/11d16f958c59d8dff5aa0c50423b9b8a4eb8db361d201c9d31e82914fd73/postmen-0.3.tar.gz"
}
],
"0.4": [
{
"comment_text": "",
"digests": {
"md5": "b68288d7395d99936625e0dce273c13d",
"sha256": "28ad838cd75c5a67e07d0892e786e46d927e0d13a43cb790e5ebb1ec9938549e"
},
"downloads": -1,
"filename": "postmen-0.4.tar.gz",
"has_sig": false,
"md5_digest": "b68288d7395d99936625e0dce273c13d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7024,
"upload_time": "2015-07-15T04:46:44",
"url": "https://files.pythonhosted.org/packages/42/97/2b15f7955c7cc0773c290d56375255e9acb752cc3abc0494595eb9fc9d7c/postmen-0.4.tar.gz"
}
],
"1.0": [
{
"comment_text": "",
"digests": {
"md5": "8c950727a81af9c425cc900b67afea36",
"sha256": "652a8e5772722b29f64d916f77b82e5ef693d3ed40e453babc783b807d5c0ccd"
},
"downloads": -1,
"filename": "postmen-1.0.tar.gz",
"has_sig": false,
"md5_digest": "8c950727a81af9c425cc900b67afea36",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16391,
"upload_time": "2016-02-04T01:01:09",
"url": "https://files.pythonhosted.org/packages/75/c6/2be1e72140d6742a4c5aea6dc965a1727bcf37e82cbab4f6c2f5dd8b5672/postmen-1.0.tar.gz"
}
],
"1.2": [
{
"comment_text": "",
"digests": {
"md5": "0c59ab19a2cbe519f7d8890009fada13",
"sha256": "064a3eb9d659491309ed597bf0467a26a7c3e4a18df9b8e32395477f170266a2"
},
"downloads": -1,
"filename": "postmen-1.2.tar.gz",
"has_sig": false,
"md5_digest": "0c59ab19a2cbe519f7d8890009fada13",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16489,
"upload_time": "2017-12-13T03:40:29",
"url": "https://files.pythonhosted.org/packages/05/47/fb94ca144de714223abb4b11748e708c13f615aebbce7c5f9d9ce7348b83/postmen-1.2.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "0c59ab19a2cbe519f7d8890009fada13",
"sha256": "064a3eb9d659491309ed597bf0467a26a7c3e4a18df9b8e32395477f170266a2"
},
"downloads": -1,
"filename": "postmen-1.2.tar.gz",
"has_sig": false,
"md5_digest": "0c59ab19a2cbe519f7d8890009fada13",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16489,
"upload_time": "2017-12-13T03:40:29",
"url": "https://files.pythonhosted.org/packages/05/47/fb94ca144de714223abb4b11748e708c13f615aebbce7c5f9d9ce7348b83/postmen-1.2.tar.gz"
}
]
}