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
A modular telegram Python bot running on python3 with an sqlalchemy database.

TG_Bot A modular telegram Python bot running on python3 with an sqlalchemy database. Originally a simple group management bot with multiple admin feat

Movindu Bandara 1 Nov 02, 2021
L3DAS22 challenge supporting API

L3DAS22 challenge supporting API This repository supports the L3DAS22 IEEE ICASSP Grand Challenge and it is aimed at downloading the dataset, pre-proc

L3DAS 38 Dec 25, 2022
A EddieHub API python package.

EddieHub A EddieHub API python package. Made with Python3 (C) @FayasNoushad Copyright permission under MIT License License - https://github.com/Fayas

Fayas Noushad 5 Sep 22, 2021
Bot telegram yang menggemakan pesan apa pun yang Anda kirim atau modifikasi untuk menganonimkan pesan

Bot telegram yang menggemakan pesan apa pun yang Anda kirim atau modifikasi untuk menganonimkan pesan

KEN KAN 2 Oct 21, 2022
A multipurpose, semi-modular Discord bot written in Python with the new discord.py module.

Discord.py Reaction Bot MIRAI KURIYAMA A multipurpose, semi-modular Discord bot written in Python with the new discord.py module. Installing dependenc

1 Dec 02, 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
🤖 Chegg answers requested and sent by the Discord BOT to the targeted user.

Chegg BOT Description "I believe that open-source resources are a must for everyone around. Especially in the field of education. As Chegg c

Vusal Ismayilov 33 Aug 20, 2021
A smart tool to backup members 📈 So you even after a raid/ ban you can easily restore them in seconds 🎲

🤑 Discord-backer 🤑 A open-source Discord member backup and restore tool for your server. This can help you get all your members in 5 Seconds back af

John 29 Dec 21, 2022
Discord bot for Ukrfans Discord server

Ukrfans Discord Bot Discord bot for Ukrfans Discord server. 💡 Prerequisites Python ⚙️ Build & Run Create an .env file in the root directory and add t

3 Jun 24, 2022
Userbot untuk memutar video dan lagu di vcg/os

Userbot untuk memutar video dan lagu di vcg/os

FJ_GAMING 2 Nov 13, 2021
Бот для мини-игры "Рабы" ("Рабство") ВКонтакте.

vk-slaves-bot Бот для мини-игры "Рабы" ("Рабство") ВК Группа в ВК, в ней публикуются новости и другая полезная информация. У группы есть беседа, в кот

Almaz 80 Dec 17, 2022
Okaeri Robot: a modular bot running on python3 with anime theme and have a lot features

OKAERI ROBOT Okaeri Robot is a modular bot running on python3 with anime theme a

Dream Garden (rey) 2 Jan 19, 2022
Just a python library to make reddit post caching easier

Reddist Just a python library to make reddit post caching easier. Caching Options In Memory Caching Redis Caching Pickle Caching Usage Installation: D

Samrid Pandit 3 Jan 16, 2022
Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python

Autodrive Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python. It is especially designed

Chris Larabee 1 Oct 02, 2021
Simple software that can send WhatsApp message to a single or multiple users (including unsaved number**)

wp-automation Info: this is a simple automation software that sends WhatsApp message to single or multiple users. Key feature: -Sends message to multi

3 Jan 31, 2022
Rock API is an API that allows you to view rocks and find the ratings on them

Rock API The best Rock API What is Rock API? Rock API is an API that allows you to view rocks and find the ratings on them. However, this isn't a regu

Conos 21 Sep 21, 2022
This is to notify you via Discord whenever there is a new beacon.

BeaconNotifier-Discord This is to notify you via Discord whenever there is a new beacon. Make sure you have python3 installed Steps: Create a Discord

26 Dec 28, 2022
The official Python library for Shodan

shodan: The official Python library and CLI for Shodan Shodan is a search engine for Internet-connected devices. Google lets you search for websites,

John Matherly 2.1k Dec 31, 2022
Make a command interpreter that manages AirBnb objects

AirBnB Clone Project Description This is part 1 of our AirBnb Clone project. The purpose of this project is to make a command interpreter that manages

Firdaus H. Salim 1 Nov 14, 2021
A Google Charts API for Python, meant to be used as an alternative to matplotlib.

GooPyCharts A Google Charts API for Python 2 and 3, meant to be used as an alternative to matplotlib. Syntax is similar to MATLAB. The goal of this pr

Sagnik Ghosh 202 Oct 04, 2022