A full-featured Python wrapper for the Onfleet API.

Overview

UPDATE: Please use Onfleet's wrapper instead. This repository is not maintained.

https://github.com/onfleet/pyonfleet

---

Python-Onfleet

civersion

python-onfleet is an easy-to-use and fully-functional Python wrapper for the Onfleet API.

Installation

python-onfleet is available for download through the Python Package Index (PyPi). You can install it right away using pip or easy_install.

pip install onfleet

No dependencies (besides Python >= 2.7).

Usage

To get started, you're going to need to get an Onfleet account set up and create an API token. Once you've got that, you're ready to go.

>>> import onfleet
>>> on = onfleet.Onfleet(api_token)

Once you've done this, you can now use the on object to make calls to the Onfleet API. Here are some examples:

Organizations

>>> organization = on.organization()
>>> organization
<Organization id='O1o6D8OryDMILx2YEW3YOFFg'>
>>> organization.created_on
1425052175000

Administrators

Create a new administrator:

>>> administrator = onfleet.Administrator(name="John Doe", email="[email protected]")
>>> on.admins(administrator, method="POST")
<Administrator id='lMmclZVdpCqzpN9~tSzvIjHn'>

List all administrators:

>>> on.admins()
[<Administrator id='lMmclZVdpCqzpN9~tSzvIjHn'>,
 <Administrator id='IP4mhhsuA*RivOvpJG9y~tI7'>]
>>> admins = _
>>> admins[0].name
John Doe

Workers

List workers:

>>> on.workers()
<Worker name='John D'>, <Worker name='Sally D'>]

Create a new worker:

>>> vehicle = onfleet.Vehicle(vehicle_type=onfleet.Vehicle.CAR, description="2010 Jetta", licensePlate="123456", color="White")
>>> worker = onfleet.Worker(name="John Smith", phone="1234567890", vehicle=vehicle)
>>> on.worker(worker, method="POST")

Get a single worker:

>>> onfleet.Worker[worker_id]()
<Worker name='John D'>

Update a worker:

>>> worker = onfleet.Worker(id="12345", tasks=["1234"])
>>> on.worker(worker, method="PUT")

Teams

List teams:

>>> on.teams()
[{u'id': u'n3MMWj0Cq6emWBg1v0ugJ46f',
  u'managers': [u'BKH3rtJxU*XdH6anWsn1YEsU'],
  u'name': u'Test Team',
  u'timeCreated': 1427748462000,
  u'timeLastModified': 1427905261933,
  u'workers': [u'i0TlEqfEk8E65a4dW~0J58VZ', u'SKmm09tPTCLkEWnGKW1AsLh9']}]

Get a single team:

>>> on.teams['n3MMWj0Cq6emWBg1v0ugJ46f']()
{u'id': u'n3MMWj0Cq6emWBF1a0ugJ46f',
 u'managers': [],
 u'name': u'Test Team',
 u'timeCreated': 1427748462000,
 u'timeLastModified': 1427905261933,
 u'workers': [{u'id': u'i0TlEqfak8E65i4dW~0J58VZ',
   u'name': u'John D',
   u'phone': u'+17172372831'},
  {u'id': u'SKmm09j3jJJKHanGKW1AsLW9',
   u'name': u'Sally R',
   u'phone': u'+15023838282'}]}

Destinations

Create a new destination:

>>> destination = on.destinations(Destination(address=Address(unparsed="543 Howard Street, San Francisco, CA 94105")), method="POST")
>>> destination
<Destination id='RJ6SnbJntnGx3M72QvDnWDhn'>
>>> destination.location
[-122.3965731, 37.7875728]

Get a single destination:

>>> on.destinations['RJ6SnbJntnGx3M72QvDnWDhn']()
<Destination id='RJ6SnbJntnGx3M72QvDnWDhn'>

Tasks

TODO

Recipients

TODO

Miscellaneous

By default, python-onfleet will return parsed JSON objects. If you'd like the raw response object for a request, just pass in parse_response=False.

>>> response = on.organization(parse_response=False)
... your org ...

Python-onfleet maps 1-1 to the Onfleet API (e.g., pb.one.two.three['1234']() will send a request to "https://api.onfleet.com/api/v2/one/two/three/1234"). For more information on other methods and usage, please read the Onfleet API documentation.

Support

If you like this library, or need help implementing it, send us an email: [email protected].

License

http://img.shields.io/pypi/l/onfleet.svg?style=flat

Apache License, Version 2.0. See LICENSE for details.

Owner
Lionheart Software
Lionheart Software
An enhanced discord.py, based off of the now-archived discord.py project

enhanced-discord.py A modern, maintained, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. The Future of enhanced

Devision 2 Dec 21, 2022
Often discord bots just die, and we hardly find one that is durable

Muitas vezes bots do discord simplesmente morrem, e dificilmente achamos um que seja durável. Então porque não ter um próprio para emergências? Como c

Guilherme Almeida 3 Dec 06, 2022
Ethereum transactions and wallet information for people you follow on Twitter.

ethFollowing Ethereum transactions and wallet information for people you follow on Twitter. Set up Setup python environment (requires python 3.8): vir

Brian Donohue 2 Dec 28, 2021
WhatsApp Multi Device Client

WhatsApp Multi Device Client

23 Nov 18, 2022
🌶️ Give real chat boosting to your discord server.

Chat-Booster Give real chat boosting to your discord server. ✅ Setup: - Add token to scrape messages on server that you whant. - Put the token in

&! Ѵιchy.#0110 36 Nov 04, 2022
pyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Master Server

PyDuinoCoin PyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Main Server. I

BackrndSource 6 Jul 14, 2022
A module grouping multiple translation APIs

translatepy (originally: translate) An aggregation of multiple translation API Translate, transliterate, get the language of texts in no time with the

349 Jan 06, 2023
Deploy your apps on any Cloud provider in just a few seconds

The simplest way to deploy your apps in the Cloud Deploy your apps on any Cloud providers in just a few seconds ⚡ Qovery Engine is an open-source abst

Qovery 1.9k Dec 26, 2022
AWS EC2 S3 Automated With python

AWS_EC2_S3_Automated Description This programme is a Python3 script that utilizes Boto3 to automate the process of creating an AWS EC2 instance with a

niall_crowe 2 Nov 16, 2021
API Wrapper for seedr.cc

Seedr Python Client Seedr API built with 💛 by Souvik Pratiher Hit that Star button if you like this kind of SDKs and wants more of similar SDKs for o

Souvik Pratiher 2 Oct 24, 2021
An API wrapper for Discord written in Python.

disnake A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. About disnake All the contributors and develop

557 Jan 05, 2023
A hyper-user friendly bot framework built on hikari

Framework A hyper-user friendly bot framework built on hikari. Framework is based off the blocking discord library disco, In both modularity and struc

Vincent 1 Jan 10, 2022
Louis Manager Bot With Python

✨ Natsuki ✨ Are You Okay Baby I'm Natsuki Unmaintained. The new repo of @TheNatsukiBot is public. ⚡ (It is no longer based on this source code. The co

Team MasterXBots 1 Nov 07, 2021
aws-lambda-scheduler lets you call any existing AWS Lambda Function you have in a future time.

aws-lambda-scheduler aws-lambda-scheduler lets you call any existing AWS Lambda Function you have in the future. This functionality is achieved by dyn

Oğuzhan Yılmaz 57 Dec 17, 2022
An open source development framework to help you build data workflows and modern data architecture on AWS.

AWS DataOps Development Kit (DDK) The AWS DataOps Development Kit is an open source development framework for customers that build data workflows and

Amazon Web Services - Labs 111 Dec 23, 2022
Gnosis-py includes a set of libraries to work with Ethereum and Gnosis projects

Gnosis-py Gnosis-py includes a set of libraries to work with Ethereum and Gnosis projects: EthereumClient, a wrapper over Web3.py Web3 client includin

Gnosis 93 Dec 23, 2022
IOGen - An Open source discord token generator

_____ ____ _____ |_ _/ __ \ / ____| | || | | | |

0xVichy#1234 85 Nov 03, 2022
Discord bot to monitor collection of mods on the Steam Workshop and notify on update to selected discord server via Nextcordbot API.

Steam-Workshop-Monitor Discord bot to monitor collection of mods on the Steam Workshop and notify on update to selected Discord channel via Nextcordbo

7 Nov 03, 2022
Python library for generating sequences with uniform stimulus history

Sampling Euler tours for uniform stimulus history Table of Contents About Examples Experiment 1 Experiment 2 Experiment 3 Experiment 4 Experiment 5 Co

5 Nov 11, 2021
Bot developed in python, 100% open-source, compatible with Windows and Linux.

Bombcrypto Bot [Family JOW] Bot desenvolvido em python, 100% do código é aberto, para aqueles que tenham conhecimento validarem que não existe nenhum

Renato Maia 71 Dec 20, 2022