{ "info": { "author": "James Li", "author_email": "support@onfleet.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.7" ], "description": "# Onfleet Python Wrapper\n\n![Travis (.org)](https://img.shields.io/travis/onfleet/pyonfleet.svg?style=popout-square)\n[![GitHub](https://img.shields.io/github/license/onfleet/pyonfleet.svg?style=popout-square)](https://github.com/onfleet/pyonfleet/blob/master/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/pyonfleet.svg?style=popout-square)](https://pypi.org/project/pyonfleet/)\n![GitHub top language](https://img.shields.io/github/languages/top/onfleet/pyonfleet.svg?style=popout-square)\n\n*Read this document in another language: [English](https://github.com/onfleet/pyonfleet/blob/master/README.md), [\u6b63\u9ad4\u4e2d\u6587](https://github.com/onfleet/pyonfleet/blob/master/README.zh-tw.md)*\n\nIf you have any questions, please reach out to Onfleet by submitting an issue [here](https://github.com/onfleet/pyonfleet/issues) or contact support@onfleet.com\n\n## Table of Contents\n- [Onfleet Python Wrapper](#onfleet-python-wrapper)\n * [Table of Contents](#table-of-contents)\n * [Synopsis](#synopsis)\n * [Installation](#installation)\n * [Usage](#usage)\n + [Throttling](#throttling)\n + [Responses](#responses)\n + [Supported CRUD Operations](#supported-crud-operations)\n - [GET Requests](#get-requests)\n * [Examples of get()](#examples-of-get--)\n * [Examples of get(param)](#examples-of-get-param-)\n * [Examples of getByLocation:](#examples-of-getbylocation-)\n - [POST Requests](#post-requests)\n * [Examples of create()](#examples-of-create--)\n - [PUT Requests](#put-requests)\n * [Examples of update()](#examples-of-update--)\n * [Examples of updateSchedule()](#examples-of-updateschedule--)\n * [Examples of insertTask()](#examples-of-inserttask--)\n - [DELETE Requests](#delete-requests)\n * [Examples of deleteOne()](#examples-of-deleteone--)\n\n## Synopsis\n\nThe Onfleet Python library provides convenient access to the Onfleet API. \n\n## Installation\n\n```\npip install pyonfleet\n```\n## Usage\nBefore using the API wrapper, you will need to obtain an API key from your organization admin. Creation and integration of API keys are performed through the [Onfleet dashboard](https://onfleet.com/dashboard#/manage).\n\nTo authenticate, you will also need to create a file named `.auth.json` under your working directory, this is where you will store your API credentials.\n\nThe format of `.auth.json` is shown below:\n```json\n{\n \"API_KEY\": \"\", \n}\n```\nYou can also opt in to not store your API key here and use it on the fly instead.\n\nOnce the Onfleet object is created, you will get access to all the API endpoints as documented in the [Onfleet API documentation](http://docs.onfleet.com/). Here are some usage case:\n```python\nfrom onfleet import Onfleet\n\napi = Onfleet() # if .auth.json was provided\napi = Onfleet(api_key=\"\") # if no .auth.json was provided\n```\n\n### Throttling\nRate limiting is enforced by the API with a threshold of 20 requests per second across all your organization's API keys, learn more about it [here](http://docs.onfleet.com/docs/throttling). \n\n### Responses\nThe `pyonfleet` API wrapper returns the body of a [Response object](https://2.python-requests.org//en/master/api/#requests.Response).\n\n### Supported CRUD Operations \nThe base URL for the Onfleet API is `https://onfleet.com/api/v2`, here are the supported CRUD operations for each endpoint:\n\n| `` | GET | POST | PUT | DELETE |\n|:------------:|:---------------------------------------------------------------:|:----------------------------------------------------------------------:|:------------------------------------:|:-------------:|\n| [Admins](http://docs.onfleet.com/docs/administrators) | get() | create(body) | update(id, body) | deleteOne(id) |\n| [Containers](http://docs.onfleet.com/docs/containers) | get(workers=id), get(teams=id), get(organizations=id) | x | update(id, body) | x |\n| [Destinations](http://docs.onfleet.com/docs/destinations) | get(id) | create(body) | x | x |\n| [Hubs](http://docs.onfleet.com/docs/hubs) | get() | x | x | x |\n| [Organization](http://docs.onfleet.com/docs/organizations) | get(), get(id) | x | insertTask(id, body) | x |\n| [Recipients](http://docs.onfleet.com/docs/recipients) | get(id), get(name), get(phone) | create(body) | update(id, body) | x |\n| [Tasks](http://docs.onfleet.com/docs/tasks) | get(queryParams), get(id), get(shortId) | create(body), clone(id), forceComplete(id), batch(body), autoAssign(body) | update(id, body) | deleteOne(id) |\n| [Teams](http://docs.onfleet.com/docs/teams) | get(), get(id) | create(body) | update(id, body), insertTask(id, body) | deleteOne(id) |\n| [Webhooks](http://docs.onfleet.com/docs/webhooks) | get() | create(body) | x | deleteOne(id) |\n| [Workers](http://docs.onfleet.com/docs/workers) | get(), get(queryParams), get(id), getByLocation(queryParams), getSchedule(id) | create(body), setSchedule(id, body) | update(id, body), insertTask(id, body) | deleteOne(id) |\n\n#### GET Requests\nTo get all the documents within an endpoint:\n```python\nget()\n```\n##### Examples of get()\n```python\napi.workers.get()\napi.workers.get(queryParams=\"\")\n```\nOption to use query parameters for some certain endpoints, refer back to API documents for endpoints that support query parameters:\n```python\napi.workers.get(queryParams=\"phones=\")\n\nor\n\napi.workers.get(queryParams={\"phones\":\"\"})\n```\n\nTo get one of the document within an endpoint, specify the param that you wish to search by:\n```python\nget(param=)\n```\n\n##### Examples of get(param) \n```python\napi.workers.get(id=\"<24_digit_id>\")\napi.workers.get(id=\"<24_digit_id>\", queryParams={\"analytics\": \"true\"})\napi.tasks.get(shortId=\"\")\napi.recipients.get(phone=\"\")\napi.recipients.get(name=\"\")\n\napi.containers.get(workers=\"\")\napi.containers.get(teams=\"\")\napi.containers.get(organizations=\"\")\n```\nTo get a driver by location, use the `getByLocation` function:\n```python\ngetByLocation(queryParams=)\n```\n\n##### Examples of getByLocation:\n```python\nparams = {\"longitude\":\"-122.4\",\"latitude\":\"37.7601983\",\"radius\":\"6000\"}\napi.workers.getByLocation(queryParams=params)\n```\n\n#### POST Requests\nTo create a document within an endpoint:\n```python\ncreate(body=\"\")\n```\n##### Examples of create()\n```python\ndriver = {\n \"name\": \"A Swartz Test\",\n \"phone\": \"+16173428853\",\n \"teams\": [\"\", \" (optional)...\"],\n \"vehicle\": {\n \"type\": \"CAR\",\n \"description\": \"Tesla Model S\",\n \"licensePlate\": \"FKNS9A\",\n \"color\": \"purple\",\n }\n}\n\napi.workers.create(body=driver)\n```\nExtended POST requests include `clone`, `forceComplete`, `batchCreate`, `autoAssign` on the tasks endpoint, and `setSchedule` on the workers endpoint:\n\n```python\napi.tasks.clone(id=\"<24_digit_id>\")\napi.tasks.forceComplete(id=\"<24_digit_id>\", body=\"\")\napi.tasks.batchCreate(body=\"\")\napi.tasks.autoAssign(body=\"\")\n\napi.workers.setSchedule(id=\"<24_digit_id>\", body=\"\")\n```\nFor more details, check our documentation on [clone](http://docs.onfleet.com/docs/tasks#clone-task), [forceComplete](http://docs.onfleet.com/docs/tasks#complete-task), [batchCreate](http://docs.onfleet.com/docs/tasks#create-tasks-in-batch), [autoAssign](http://docs.onfleet.com/docs/tasks#automatically-assign-get-of-tasks), and [setSchedule](http://docs.onfleet.com/docs/workers#set-workers-schedule).\n\n#### PUT Requests\nTo update a document within an endpoint:\n```python\nupdate(id=\"<24_digit_id>\", body=\"\")\n```\n##### Examples of update()\n```python\nupdateBody = {\n \"name\": \"New Driver Name\",\n}\napi.workers.update(id=\"<24_digit_id>\", body=updateBody)\n```\n##### Examples of updateSchedule()\n```python\napi.workers.updateSchedule(id=\"<24_digit_id>\", body=newSchedule)\n```\nFor more details, check our documentation on [updateSchedule](http://docs.onfleet.com/docs/workers#update-workers-schedule)\n\n##### Examples of insertTask()\n```python\napi.workers.insertTask(id=\"kAQ*G5hnqlOq4jVvwtGNuacl\", body=\"\")\n```\n\n#### DELETE Requests\nTo delete a document within an endpoint:\n```python\ndeleteOne(id=\"<24_digit_id>\")\n```\n##### Examples of deleteOne()\n```python\napi.workers.deleteOne(id=\"<24_digit_id>\")\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://docs.onfleet.com", "keywords": "", "license": "LICENSE", "maintainer": "", "maintainer_email": "", "name": "pyonfleet", "package_url": "https://pypi.org/project/pyonfleet/", "platform": "", "project_url": "https://pypi.org/project/pyonfleet/", "project_urls": { "Homepage": "http://docs.onfleet.com" }, "release_url": "https://pypi.org/project/pyonfleet/1.0.1/", "requires_dist": [ "requests", "configparser" ], "requires_python": "", "summary": "Onfleet's Python API Wrapper Package", "version": "1.0.1" }, "last_serial": 5303857, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "ee6ef85da8b661ab35a3015a107942e2", "sha256": "24063dd61f50b8dbed951ff5c7a0a9cd663da88cab3114bbd9d35acb52f08788" }, "downloads": -1, "filename": "pyonfleet-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "ee6ef85da8b661ab35a3015a107942e2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9809, "upload_time": "2019-05-22T16:47:11", "url": "https://files.pythonhosted.org/packages/42/2c/5a1a7efe8049fcb3d809b31eb592f19e40e70b46513b84af0d402dbb17c0/pyonfleet-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "290cf60d47bd324af9c34f60950cd237", "sha256": "2dc1b653a516189010528fe6548135cfbcd2860b2e086ebf45a70d87e74d5f33" }, "downloads": -1, "filename": "pyonfleet-1.0.0.tar.gz", "has_sig": false, "md5_digest": "290cf60d47bd324af9c34f60950cd237", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11462, "upload_time": "2019-05-22T16:47:13", "url": "https://files.pythonhosted.org/packages/43/0f/daec0dbc4f274a1f754d1621ae8f729a83fc2411c6a2ac64cba33a736e9e/pyonfleet-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "38363e56ccd4df701fe17ac7768b91ae", "sha256": "93ec561c6c2e30a45591d86ed077a7a1ada38959dd1729063f0e58b255884962" }, "downloads": -1, "filename": "pyonfleet-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "38363e56ccd4df701fe17ac7768b91ae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9817, "upload_time": "2019-05-22T17:51:49", "url": "https://files.pythonhosted.org/packages/67/60/7ed3221631d8a6e8e13688ffe706921dc402d74c0ac663bf5f03f5fcec70/pyonfleet-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "582b7ed0ee49fa97ee18094434993d40", "sha256": "b162dd388503cad4368db7f5bb0229b6436dedf215949c7ed1dca0f63b186ce8" }, "downloads": -1, "filename": "pyonfleet-1.0.1.tar.gz", "has_sig": false, "md5_digest": "582b7ed0ee49fa97ee18094434993d40", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11550, "upload_time": "2019-05-22T17:51:50", "url": "https://files.pythonhosted.org/packages/31/1c/e8169cf6e2dc3b7a9d8bfb6480a27548d867c2297559da3c58b52bf13d82/pyonfleet-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "38363e56ccd4df701fe17ac7768b91ae", "sha256": "93ec561c6c2e30a45591d86ed077a7a1ada38959dd1729063f0e58b255884962" }, "downloads": -1, "filename": "pyonfleet-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "38363e56ccd4df701fe17ac7768b91ae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9817, "upload_time": "2019-05-22T17:51:49", "url": "https://files.pythonhosted.org/packages/67/60/7ed3221631d8a6e8e13688ffe706921dc402d74c0ac663bf5f03f5fcec70/pyonfleet-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "582b7ed0ee49fa97ee18094434993d40", "sha256": "b162dd388503cad4368db7f5bb0229b6436dedf215949c7ed1dca0f63b186ce8" }, "downloads": -1, "filename": "pyonfleet-1.0.1.tar.gz", "has_sig": false, "md5_digest": "582b7ed0ee49fa97ee18094434993d40", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11550, "upload_time": "2019-05-22T17:51:50", "url": "https://files.pythonhosted.org/packages/31/1c/e8169cf6e2dc3b7a9d8bfb6480a27548d867c2297559da3c58b52bf13d82/pyonfleet-1.0.1.tar.gz" } ] }