{ "info": { "author": "Takashi Nishibayashi", "author_email": "takashi_nishibayashi@voyagegroup.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Utilities" ], "description": "APNs Proxy Python Client\n========================\n\nClient program of `APNs Proxy\nServer `__\n\n|Build Status|\n\nInstallation\n------------\n\n::\n\n pip install apns-proxy-client\n\nHow to Use\n----------\n\n.. code:: python\n\n from apns_proxy_client import APNSProxyClient\n\n client = APNSProxyClient(host=\"localhost\", port=5556, application_id=\"myapp\")\n with client:\n # send \"Hello\" alerts to many tokens\n for token in many_tokens:\n client.send(token, 'Hello', badge=1)\n\n # get disabled device tokens from feedback service\n feedback = client.get_feedback()\n\nOR use ``connect()`` and ``close()`` instead of ``with``\n\n.. code:: python\n\n from apns_proxy_client import APNSProxyClient\n\n client = APNSProxyClient(host=\"localhost\", port=5556, application_id=\"myapp\")\n client.connect()\n # send \"Hello\" alerts to many tokens\n for token in many_tokens:\n client.send(token, 'Hello')\n\n # get disabled device tokens from feedback service\n feedback = client.get_feedback()\n client.close()\n\nSet host and port for your server running on. application\\_id is\nspecified in settings.py on apns-proxy-server.\n\nsend() method synopsis\n~~~~~~~~~~~~~~~~~~~~~~\n\n.. code:: python\n\n token = \"YOUR_VALID_DEVICE_TOKEN\"\n\n client = APNSProxyClient(host=\"localhost\", port=5556, application_id=\"myapp\")\n with client:\n # Simple\n client.send(token, 'Hello')\n\n # Custom sound (default = 'default')\n client.send(token, 'Alert with custom sound', sound='custom')\n\n # Message without sound\n client.send(token, 'I am silent', sound=None)\n\n # Badge\n client.send(token, 'Alert with badge', badge=2)\n\n # Change badge silently\n client.send(token, None, sound=None, badge=9999)\n\n # Set expiry (default = 1hour)\n four_hours_later = int(time.time()) + (60 * 60 * 4)\n client.send(token, 'I am long life', expiry=four_hours_later)\n\n # Set priority (default = 10)\n client.send(token, 'I am low priority', priority=5)\n\n # For background fetch\n client.send(token, None, sound=None, content_available=True)\n\n # With custom field.\n client.send(token, 'With custom field', custom={\n 'foo': True,\n 'bar': [200, 300],\n 'boo': \"Hello\"\n })\n # Finally following payload will send to APNs\n # {\n # \"aps\": {\n # \"alert\": \"With custom field\",\n # \"sound\": \"default\",\n # },\n # \"foo\": True,\n # \"bar\": [200, 300],\n # \"boo\": \"Hello\"\n #}\n\n # Use JSON Payload\n client.send(token, {\n 'body': 'This is JSON alert',\n 'action_loc_key': None,\n 'loc_key': 'loc key',\n 'loc_args': ['one', 'two'],\n 'launch_image': 'aa.png'\n })\n\n # All\n client.send(token, 'Many opts', sound='foo', badge=2, content_available=True,\n custom={\"bar\": \"boo\"}, expiry=four_hour_later, priority=5)\n\n # Test. APNsProxyServer don't send to APNs\n client.send(token, 'This message never send to device', test=True)\n\nParameters of send method\n\n+----------------------+---------------------------+------------+---------------------------------+\n| Name | Type | Required | Default Value (Set on server) |\n+======================+===========================+============+=================================+\n| token | string | yes | - |\n+----------------------+---------------------------+------------+---------------------------------+\n| alert | string, unicode or dict | yes | - |\n+----------------------+---------------------------+------------+---------------------------------+\n| sound | string | no | 'default' |\n+----------------------+---------------------------+------------+---------------------------------+\n| badge | number | no | None |\n+----------------------+---------------------------+------------+---------------------------------+\n| content\\_available | bool | no | False |\n+----------------------+---------------------------+------------+---------------------------------+\n| custom | dict | no | None |\n+----------------------+---------------------------+------------+---------------------------------+\n| expiry | date | no | 1 hour |\n+----------------------+---------------------------+------------+---------------------------------+\n| priority | number | no | 10 |\n+----------------------+---------------------------+------------+---------------------------------+\n| test | bool | no | False |\n+----------------------+---------------------------+------------+---------------------------------+\n\nget\\_feedback() method synopsis\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis client library provides a way to get disabled device tokens from\nAPNs feedback service; just call ``get_feedback()`` without any\nparameters.\n\n``get_feedback()`` returns the dict that is a pair of \"device\\_token\"\nand \"timestamp\".\n\n+-----------------+----------+---------------------------------------------------------------------------------------------------------------------------------------+\n| Name | Type | Description |\n+=================+==========+=======================================================================================================================================+\n| device\\_token | string | The device token string which cannot be received push notifications |\n+-----------------+----------+---------------------------------------------------------------------------------------------------------------------------------------+\n| timestamp | float | The seconds since 00:00 on January 1, 1970 UTC. This value means a timestamp which APNs judged the device token should be disabled. |\n+-----------------+----------+---------------------------------------------------------------------------------------------------------------------------------------+\n\n.. code:: python\n\n client = APNSProxyClient(host=\"localhost\", port=5556, application_id=\"myapp\")\n with client:\n feedback = client.get_feedback()\n # a value of feedback likes the following dict:\n # {\n # \"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\": 1399442843.0, # device_token : unix timestamp\n # \"abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789\": 1399442892.0,\n # }\n\nFor contributor\n---------------\n\nMakefile provides some useful commands.\n\n+--------------+---------------------------+\n| Command | Description |\n+==============+===========================+\n| make setup | Setup work directory |\n+--------------+---------------------------+\n| make lint | Code check using flake8 |\n+--------------+---------------------------+\n| make test | Run tests |\n+--------------+---------------------------+\n\nLicense\n-------\n\nBSD\n\n.. |Build Status| image:: https://travis-ci.org/voyagegroup/apns-proxy-client-py.png?branch=master\n :target: https://travis-ci.org/voyagegroup/apns-proxy-client-py", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/voyagegroup/apns-proxy-client-py", "keywords": "apns", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "apns-proxy-client", "package_url": "https://pypi.org/project/apns-proxy-client/", "platform": "any", "project_url": "https://pypi.org/project/apns-proxy-client/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/voyagegroup/apns-proxy-client-py" }, "release_url": "https://pypi.org/project/apns-proxy-client/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Client library for APNs Proxy Server.", "version": "0.1.0" }, "last_serial": 1089542, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8c91241268a45702a8defa2266af24e9", "sha256": "d2056b7ae8789f8a95072960c41fa0d13d8c14c77c7bed3198ee09e2584b5309" }, "downloads": -1, "filename": "apns-proxy-client-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8c91241268a45702a8defa2266af24e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6360, "upload_time": "2014-05-12T14:13:39", "url": "https://files.pythonhosted.org/packages/4e/39/c762362f082629bba9e50445c04e71cf38f76f49e61cc3b11067309b8a33/apns-proxy-client-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8c91241268a45702a8defa2266af24e9", "sha256": "d2056b7ae8789f8a95072960c41fa0d13d8c14c77c7bed3198ee09e2584b5309" }, "downloads": -1, "filename": "apns-proxy-client-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8c91241268a45702a8defa2266af24e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6360, "upload_time": "2014-05-12T14:13:39", "url": "https://files.pythonhosted.org/packages/4e/39/c762362f082629bba9e50445c04e71cf38f76f49e61cc3b11067309b8a33/apns-proxy-client-0.1.0.tar.gz" } ] }