{ "info": { "author": "Daniel Knell", "author_email": "contact@danielknell.co.uk", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "InterFAX Python Package\n=======================\n\n.. image:: https://travis-ci.org/interfax/interfax-python.svg?branch=master\n :target: https://travis-ci.org/interfax/interfax-python\n\n`Installation`_ \\| `Getting Started`_ \\| `Contributing`_ \\| `Usage`_ \\| `License`_\n\nSend and receive faxes in Python with the\n`InterFAX `__ REST API.\n\nInstallation\n------------\n\nThis package requires Python 2.6+. You can install it using:\n\n::\n\n pip install interfax\n\nGetting started\n---------------\n\nTo send a fax from a PDF file:\n\n.. code:: python\n\n from interfax import InterFAX\n\n interfax = InterFAX(username=\"username\", password=\"password\")\n fax = interfax.deliver(fax_number=\"+11111111112\", files=[\"folder/fax.pdf\"])\n fax = fax.reload() # resync with API to get latest status\n fax.status # Success if 0. Pending if < 0. Error if > 0\n\nUsage\n=====\n\n`Client`_ \\| `Account`_ \\| `Outbound`_ \\| `Inbound`_ \\| `Documents`_ \\| `Helper Classes`_\n\nClient\n------\n\nThe client follows the `12-factor `__ apps\nprinciple and can be either set directly or via environment variables.\n\n.. code:: python\n\n # Initialize using parameters\n interfax = InterFAX(username=\"...\", password=\"...\")\n\n # Alternatice: Initialize using environment variables\n # * INTERFAX_USERNAME\n # * INTERFAX_PASSWORD\n interfax = InterFAX()\n\nAll connections are established over HTTPS.\n\nAccount\n-------\n\nBalance\n~~~~~~~\n\nDetermine the remaining faxing credits in your account.\n\n.. code:: python\n\n >>> interfax.account.balance()\n 9.86\n\n**More:**\n`documentation `__\n\nOutbound\n--------\n\n`Send fax`_ \\| `Get outbound fax list`_ \\| `Get completed fax list`_ \\| `Get outbound fax record`_ \\| `Get outbound fax image`_ \\| `Cancel a fax`_ \\| `Search fax list`_\n\nSend fax\n~~~~~~~~\n\n``interfax.outbound.deliver(fax_number, files, **kwargs)``\n\nSubmit a fax to a single destination number.\n\nThere are a few ways to send a fax. One way is to directly provide a\nfile path or url.\n\n.. code:: python\n\n # with a path\n interfax.outbound.deliver(fax_number=\"+11111111112\", files=[\"folder/fax.txt\"])\n # with a URL\n interfax.outbound.deliver(fax_number=\"+11111111112\", files=[\"https://s3.aws.com/example/fax.pdf\"])\n\nInterFAX supports over 20 file types including HTML, PDF, TXT, Word, and\nmany more. For a full list see the `Supported File\nTypes `__\ndocumentation.\n\nThe returned object is a ``OutboundFax`` with just an ``id``. You can\nuse this object to load more information, get the image, or cancel the\nsending of the fax.\n\n.. code:: python\n\n fax = interfax.outbound.deliver(fax_number=\"+11111111112\", files=[\"fax.pdf\"])\n fax = fax.reload() # Reload fax, allowing you to inspect the status and more\n\n fax.id # the ID of the fax that can be used in some of the other API calls\n fax.image() # returns an image representing the fax sent to the fax_number\n fax.cancel() # cancel the sending of the fax\n\nAlternatively you can create an `File <#file>`__ with binary data and\npass this in as well.\n\n.. code:: python\n\n with open(\"fax.pdf\", \"rb\") as fp:\n f = interfax.files.create(fp.read(), mime_type=\"application/pdf\")\n interfax.outbound.deliver(fax_number=\"+11111111112\", files=[f])\n\nTo send multiple files just pass in a list of strings and `File`_ objects.\n\n.. code:: python\n\n interfax.outbound.deliver(fax_number=\"+11111111112\", files=[\"fax.pdf\", \"https://s3.aws.com/example/fax.pdf\"])\n\nUnder the hood every path and string is turned into a\n`File <#interfaxfile>`__ object. For more information see `the\ndocumentation <#interfaxfile>`__ for this class.\n\n**Keyword Arguments:** ``contact``, ``postpone_time``,\n``retries_to_perform``, ``csid``, ``page_header``, ``reference``,\n``page_size``, ``fit_to_page``, ``page_orientation``, ``resolution``,\n``rendering``\n\n**More:**\n`documentation `__\n\n**Alias**: ``interfax.deliver``\n\n--------------\n\nGet outbound fax list\n~~~~~~~~~~~~~~~~~~~~~\n\n``interfax.outbound.all(**kwargs)``\n\nGet a list of recent outbound faxes (which does not include batch\nfaxes).\n\n.. code:: python\n\n >>> interfax.outbound.all()\n [OutboundFax(id=1), ...]\n >>> interfax.outbound.all(limit=1)\n [OutboundFax(id=1)]\n\n**Keyword Arguments:** ``limit``, ``last_id``, ``sort_order``,\n``user_id``\n\n**More:**\n`documentation `__\n\n--------------\n\nGet completed fax list\n~~~~~~~~~~~~~~~~~~~~~~\n\n``interfax.outbound.completed(*args)``\n\nGet details for a subset of completed faxes from a submitted list.\n(Submitted id's which have not completed are ignored).\n\n.. code:: python\n\n >> interfax.outbound.completed(123, 234)\n [OutboundFax(id=123), ...]\n\n**More:**\n`documentation `__\n\n--------------\n\nGet outbound fax record\n~~~~~~~~~~~~~~~~~~~~~~~\n\n``interfax.outbound.find(fax_id)``\n\nRetrieves information regarding a previously-submitted fax, including\nits current status.\n\n.. code:: python\n\n >>> interfax.outbound.find(123456)\n OutboundFax(id=123456)\n\n**More:**\n`documentation `__\n\n--------------\n\nGet outbound fax image\n~~~~~~~~~~~~~~~~~~~~~~\n\n``interfax.outbound.image(fax_id)``\n\nRetrieve the fax image (TIFF file) of a submitted fax.\n\n.. code:: python\n\n >>> image = interfax.outbound.image(123456)\n Image(id=123456)\n >>> image.data\n \"....binary data....\"\n >>> image.save(\"fax.tiff\")\n # saves image to file\n\n**More:**\n`documentation `__\n\n--------------\n\nCancel a fax\n~~~~~~~~~~~~\n\n``interfax.outbound.cancel(fax_id)``\n\nCancel a fax in progress.\n\n.. code:: python\n\n interfax.outbound.cancel(123456)\n => true\n\n**More:**\n`documentation `__\n\n--------------\n\nSearch fax list\n~~~~~~~~~~~~~~~\n\n``interfax.outbound.search(**kwargs)``\n\nSearch for outbound faxes.\n\n.. code:: python\n\n >>> interfax.outbound.search(fax_number=\"+1230002305555\")\n [OutboundFax(id=1234), ...]\n\n**Keyword Arguments:** ``ids``, ``reference``, ``date_from``,\n``date_to``, ``status``, ``user_id``, ``fax_number``, ``limit``,\n``offset``\n\n**More:**\n`documentation `__\n\nInbound\n-------\n\n`Get inbound fax list`_ \\| `Get inbound fax record`_ \\| `Get inbound fax image`_ \\| `Get forwarding emails`_ \\| `Mark as read/unread`_ \\| `Resend inbound fax`_\n\nGet inbound fax list\n~~~~~~~~~~~~~~~~~~~~\n\n``interfax.inbound.all(**kwargs)``\n\nRetrieves a user's list of inbound faxes. (Sort order is always in\ndescending ID).\n\n.. code:: python\n\n interfax.inbound.all()\n => [InboundFax(id=1234), ...]\n interfax.inbound.all(limit=1)\n => [InboundFax(id=1234)]\n\n**Keyword Arguments:** ``unread_only``, ``limit``, ``last_id``,\n``all_users``\n\n**More:**\n`documentation `__\n\n--------------\n\nGet inbound fax record\n~~~~~~~~~~~~~~~~~~~~~~\n\n``interfax.inbound.find(fax_id)``\n\nRetrieves a single fax's metadata (receive time, sender number, etc.).\n\n.. code:: python\n\n >>> interfax.inbound.find(123456)\n InboundFax(id=123456)\n\n**More:**\n`documentation `__\n\n--------------\n\nGet inbound fax image\n~~~~~~~~~~~~~~~~~~~~~\n\n``interfax.inbound.image(fax_id)``\n\nRetrieves a single fax's image.\n\n.. code:: python\n\n >>> image = interfax.inbound.image(123456)\n Image(id=123456)\n >>> image.data\n \"....binary data....\"\n >>> image.save(\"fax.tiff\")\n # saves image to file\n\n**More:**\n`documentation `__\n\n--------------\n\nGet forwarding emails\n~~~~~~~~~~~~~~~~~~~~~\n\n``interfax.inbound.emails(fax_id)``\n\nRetrieve the list of email addresses to which a fax was forwarded.\n\n.. code:: python\n\n interfax.inbound.email(123456)\n [ForwardingEmail()]\n\n**More:**\n`documentation `__\n\n--------------\n\nMark as read/unread\n~~~~~~~~~~~~~~~~~~~\n\n``interfax.inbound.mark(fax_id, read=True)``\n\nMark a transaction as read/unread.\n\n.. code:: python\n\n interfax.inbound.mark(123456, read=True) # mark read\n interfax.inbound.mark(123456, read=False) # mark unread\n\n**More:**\n`documentation `__\n\n--------------\n\nResend inbound fax\n~~~~~~~~~~~~~~~~~~\n\n``interfax.inbound.resend(fax_id, email=None)``\n\nResend an inbound fax to a specific email address.\n\n.. code:: python\n\n >>> # resend to the email(s) to which the fax was previously forwarded\n >>> interfax.inbound.resend(123456)\n True\n >>> # resend to a specific address\n >>> interfax.inbound.resend(123456, email=\"test@example.com\")\n True\n\n**More:**\n`documentation `__\n\n--------------\n\nDocuments\n---------\n\n`Create Documents`_ \\| `Upload chunk`_ \\| `Get document list`_ \\| `Get document status`_ \\| `Cancel document`_\n\nDocument allow for uploading of large files up to 20MB in 200kb chunks.\nThe `File`_ format automatically uses this if needed but a\nsample implementation would look as followed.\n\n.. code:: python\n\n document = interfax.documents.create(\"test.pdf\", os.stat(\"test.pdf\").st_size)\n\n with open(\"test.pdf\", \"rb\") as fp:\n cursor = 0\n while True:\n chunk = fp.read(500)\n if not chunk:\n break\n next_cursor = cursor + len(chunk)\n document.upload(cursor, next_cursor-1, chunk)\n cursor = next_cursor\n\nCreate Documents\n~~~~~~~~~~~~~~~~\n\n``interfax.documents.create(name, size, **kwargs)``\n\nCreate a document upload session, allowing you to upload large files in\nchunks.\n\n.. code:: python\n\n >>> interfax.documents.create(\"large_file.pdf\", 231234)\n Document(id=123456)\n\n**Keyword Arguments:** ``disposition``, ``sharing``\n\n**More:**\n`documentation `__\n\n--------------\n\nUpload chunk\n~~~~~~~~~~~~\n\n``interfax.documents.upload(id, range_start, range_end, chunk)``\n\nUpload a chunk to an existing document upload session.\n\n.. code:: python\n\n >>> interfax.documents.upload(123456, 0, 999, \"....binary-data....\")\n True\n\n**More:**\n`documentation `__\n\n--------------\n\nGet document list\n~~~~~~~~~~~~~~~~~\n\n``interfax.documents.all(options = {})``\n\nGet a list of previous document uploads which are currently available.\n\n.. code:: python\n\n >>> interfax.documents.all()\n [Document(id=123456), ...]\n >>> interfax.documents.all(offset=10)\n [Document(id=123466), ...]\n\n**Keyword Arguments:** ``limit``, ``offset``\n\n**More:**\n`documentation `__\n\n--------------\n\nGet document status\n~~~~~~~~~~~~~~~~~~~\n\n``interfax.documents.find(id)``\n\nGet the current status of a specific document upload.\n\n.. code:: python\n\n >>> interfax.documents.find(123456)\n Document(id=123456)\n\n**More:**\n`documentation `__\n\n--------------\n\nCancel document\n~~~~~~~~~~~~~~~\n\n``interfax.documents.cancel(id)``\n\nCancel a document upload and tear down the upload session, or delete a\nprevious upload.\n\n.. code:: python\n\n >>> interfax.documents.cancel(123456)\n True\n\n**More:**\n`documentation `__\n\n--------------\n\nHelper Classes\n--------------\n\nOutboundFax\n~~~~~~~~~~~\n\nThe ``OutboundFax`` is returned in most Outbound APIs. As a convenience\nthe following methods are available.\n\n.. code:: python\n\n fax = interfax.outbound.find(123)\n fax = fax.reload() # Loads or reloads object\n fax.cancel() # Cancels the fax\n fax.image() # Returns an `Image` for this fax\n\nInboundFax\n~~~~~~~~~~\n\nThe ``InboundFax`` is returned in some of the Inbound APIs. As a\nconvenience the following methods are available.\n\n.. code:: python\n\n fax = interfax.inbound.find(123)\n fax = fax.reload() # Loads or reloads object\n fax.mark(true) # Marks the fax as read/unread\n fax.resend(email) # Resend the fax to a specific email address.\n fax.image() # Returns an `Image` for this fax\n fax.emails() # Returns a list of ForwardingEmail objects that the fax was forwarded on to\n\nImage\n~~~~~\n\nA lightweight wrapper around the image data for a sent or received fax.\nProvides the following convenience methods.\n\n.. code:: python\n\n image = interfax.outbound.image(123)\n image.data # Returns the raw binary data for the TIFF image.\n image.save(\"folder/fax.tiff\") # Saves the TIFF to the path provided\n\nFile\n~~~~\n\nThis class is used by ``interfax.outbound.deliver`` and\n``interfax.files`` to turn every URL, path and binary data into a\nuniform format, ready to be sent out to the InterFAX API.\n\nIt is most useful for sending binary data to the ``.deliver`` method.\n\n.. code:: python\n\n >>> # binary data\n >>> f = File(interfax, \"....binary data.....\", mime_type=\"application/pdf\")\n File()\n\n >>> # Alternatively\n >>> f = interfax.files.create(\"....binary data.....\", mime_type=\"application/pdf\")\n >>> f.headers\n {\"Content-Type\": \"application/pdf\"}\n >>> f.body\n \"....binary data.....\"\n\n interfax.outbound.deliver(fax_number=\"+1111111111112\", files=[f])\n\nAdditionally it can be used to turn a URL or path into a valid object as\nwell, though the ``.deliver`` method does this conversion automatically.\n\n.. code:: python\n\n >>> # a file by path\n >>> f = interfax.files.create(\"foo/bar.pdf\")\n >>> f.headers\n { \"Content-Type\": \"application/pdf\" }\n >>> f.body\n \"....binary data.....\"\n\n >>> # a file by url\n >>> f = interfax.files.create(\"https://foo.com/bar.html\")\n >>> f.headers\n {\"Content-Location\": \"https://foo.com/bar.html\"}\n >>> f.body\n None\n\nForwardingEmail\n~~~~~~~~~~~~~~~\n\nA light wrapper around `the\nresponse `__ received by\nasking for the forwarded emails for a fax.\n\n.. code:: python\n\n fax = interfax.inbound.find(123)\n email = fax.emails()[0]\n email.email_address # An email address to which forwarding of the fax was attempted.\n email.message_status # 0 = OK; number smaller than zero = in progress; number greater than zero = error.\n email.completion_time # Completion timestamp.\n\nDocument\n~~~~~~~~\n\nThe ``Document`` is returned in most of the Document APIs. As a\nconvenience the following methods are available.\n\n.. code:: python\n\n document = interfax.documents.find(123)\n document = document.reload() # Loads or reloads object\n document.upload(0, 999, \".....binary data....\" # Maps to the interfax.documents.upload method\n document.cancel() # Maps to the interfax.documents.cancel method\n document.id # Extracts the ID from the URI (the API does not return the ID)\n\nContributing\n------------\n\n#. **Fork** the repo on GitHub\n#. **Clone** the project to your own machine\n#. **Commit** changes to your own branch\n#. **Push** your work back up to your fork\n#. Submit a **Pull request** so that we can review your changes\n\nLicense\n-------\n\nThis library is released under the `MIT License `__.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/interfax/interfax-python", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "interfax", "package_url": "https://pypi.org/project/interfax/", "platform": "any", "project_url": "https://pypi.org/project/interfax/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/interfax/interfax-python" }, "release_url": "https://pypi.org/project/interfax/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "InterFAX python library", "version": "1.0.0" }, "last_serial": 2368978, "releases": { "0.1.0-dev": [], "1.0.0": [ { "comment_text": "", "digests": { "md5": "fb6a10ad08ddc0a2551ef159c7b27118", "sha256": "ab6504bf4f9c8ebc073b293eb97fe257ca496bcc123094772314c997351f65cd" }, "downloads": -1, "filename": "interfax-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fb6a10ad08ddc0a2551ef159c7b27118", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 17110, "upload_time": "2016-09-28T16:19:39", "url": "https://files.pythonhosted.org/packages/a9/82/d060a07084729bf7c3063f1e981249d9bfb81b72fb5b2d179ae60e6d2579/interfax-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2b0cef8e9f08de93c27016b97de6c43d", "sha256": "5e57b3a68c8674979e0879d3abac13b79081fd4f42376119304b9e0b83970d73" }, "downloads": -1, "filename": "interfax-1.0.0.tar.gz", "has_sig": false, "md5_digest": "2b0cef8e9f08de93c27016b97de6c43d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10798, "upload_time": "2016-09-28T16:19:34", "url": "https://files.pythonhosted.org/packages/45/87/e11e86f86a47a6dcc1e7b4255441be2cb3fff7561548d41d551662e83292/interfax-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fb6a10ad08ddc0a2551ef159c7b27118", "sha256": "ab6504bf4f9c8ebc073b293eb97fe257ca496bcc123094772314c997351f65cd" }, "downloads": -1, "filename": "interfax-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fb6a10ad08ddc0a2551ef159c7b27118", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 17110, "upload_time": "2016-09-28T16:19:39", "url": "https://files.pythonhosted.org/packages/a9/82/d060a07084729bf7c3063f1e981249d9bfb81b72fb5b2d179ae60e6d2579/interfax-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2b0cef8e9f08de93c27016b97de6c43d", "sha256": "5e57b3a68c8674979e0879d3abac13b79081fd4f42376119304b9e0b83970d73" }, "downloads": -1, "filename": "interfax-1.0.0.tar.gz", "has_sig": false, "md5_digest": "2b0cef8e9f08de93c27016b97de6c43d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10798, "upload_time": "2016-09-28T16:19:34", "url": "https://files.pythonhosted.org/packages/45/87/e11e86f86a47a6dcc1e7b4255441be2cb3fff7561548d41d551662e83292/interfax-1.0.0.tar.gz" } ] }