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
Converts between Spotify's new lyrics (and their proprietary format) to an LRC file for local playback.

spotify-lyrics-to-lrc Converts between Spotify's new lyrics (and their proprietary format) to an LRC file for local playback. How to use: Open Spotify

~noah~ 6 Nov 19, 2022
Telegram bot to host python bots

Host-Bot Setup the api Upload the flask api on your host #its not important to do #i used it just for simple captcha system + save ids on your host!

Plugin 15 Feb 11, 2022
Python library to connect to Firebots API

This is a firebot library to connect to Firebots API. https://firebot.app/ From Firebots Website: "Firebot is a fully featured open-source bot that c

1 Jan 08, 2022
An example of a chatbot with a number-based menu that can be used as a starting point for a project.

NumMenu Bot NumMenu Bot is an example chatbot showing a way to design a number-based menu assistant with Rasa. This type of bot is very useful on plat

Derguene 19 Nov 14, 2022
Takes upcoming items from a Google Calendar and posts them to Slack.

Google Calendar to Slack by Jason Snell - [email protected] This Python s

6 Aug 21, 2022
Join & Leave spam for aminoapps using aminoboi

JLspam.py Join & Leave spam for https://aminoapps.com using aminoboi Instalação apt-get update -y apt-get upgrade -y apt-get install git pkg install

Moleey 1 Dec 21, 2021
✖️ Unofficial API of 1337x.to

✖️ Unofficial Python API Wrapper of 1337x This is the unofficial API of 1337x. It supports all proxies of 1337x and almost all functions of 1337x. You

Hemanta Pokharel 71 Dec 26, 2022
Its Is A Telegram Maths Basic Calculator Bot

Its Is A Telegram Maths Basic Calculator Bot

ANKIT KUMAR 1 Dec 26, 2021
Migration Manager (MM) is a very small utility that can list source servers in a target account and apply mass launch template modifications.

Migration Manager Migration Manager (MM) is a very small utility that can list source servers in a target account and apply mass launch template modif

Cody 2 Nov 04, 2021
Python Dialogflow CX Scripting API (SCRAPI)

Python Dialogflow CX Scripting API (SCRAPI) A high level scripting API for bot builders, developers, and maintainers. Table of Contents Introduction W

Google Cloud Platform 39 Dec 09, 2022
A Python library for PagerDuty.

Pygerduty Python Library for PagerDuty's REST API and Events API. This library was originally written to support v1 and is currently being updated to

Dropbox 164 Dec 20, 2022
Playing around with the slack api for learning purposes

SlackBotTest Playing around with the slack api for learning purposes and getting people to contribute Reason for this Project: Bots are very versatile

1 Nov 24, 2021
A Flask inspired, decorator based API wrapper for Python-Slack.

A Flask inspired, decorator based API wrapper for Python-Slack. About Tangerine is a lightweight Slackbot framework that abstracts away all the boiler

Nick Ficano 149 Jun 30, 2022
A wrapper for aqquiring Choice Coin directly through a Python Terminal. Leverages the TinyMan Python-SDK.

CHOICE_TinyMan_Wrapper A wrapper that allows users to acquire Choice Coin directly through their Terminal using ALGO and various Algorand Standard Ass

Choice Coin 16 Sep 24, 2022
Discord Multitool made in python 3.9

XTool Discord Multitool 24 Features: Webhook Delete VC Lagger Fast Token Checker Mass Report [Not Done] Token rape 2K Characters Bypass Block bypass M

Tiie 50 Dec 20, 2022
A superb Telegram VoiceChat Player. Powered by FalconRoBo.

𝕱𝖆𝖑𝖈𝖔𝖓𝕸𝖚𝖘𝖎𝖈 A sᴜᴘᴇʀʙ Tᴇʟᴇɢʀᴀᴍ VᴏɪᴄᴇCʜᴀᴛ Pʟᴀʏᴇʀ, ᴍᴀᴅᴇ ᴜsɪɴɢ Lᴀᴛᴇsᴛ Pʏᴛʜᴏɴ ᴀɴᴅ Pʏʀᴏɢʀᴀᴍ. 𝑷𝒐𝒘𝒆𝒓𝒆𝒅 𝒃𝒚 𝑭𝒂𝒍𝒄𝒐𝒏𝑹𝒐𝑩𝒐 FalconMusic

FalconRoBo 2 Oct 21, 2022
Python script to replace BTC adresses in the clipboard with similar looking ones, whose private key can be retrieved by a netcat listener or similar.

BTCStealer Python script to replace BTC adresses in the clipboard with similar looking ones, whose private key can be retrieved by a netcat listener o

Some Person 6 Jun 07, 2022
Disco is an extensive and extendable Python 2.x/3.x library for the Discord API.

disco Disco is an extensive and extendable Python 2.x/3.x library for the Discord API. Disco boasts the following major features: Expressive, function

1 Nov 18, 2021
Faux is a chatbot bridge between urbit and discord.

Faux Faux is a chatbot bridge between urbit and discord. Whenever a member posts in your discord group, a bot will echo their message in your urbit gr

10 Dec 27, 2022
Super simple anti-spam Discord bot

AutoAntiRaidBot Super simple anti-spam Discord bot. Will automatically kick any member with an account made under 1 day ago, and will ban any member w

Kainoa Kanter 6 Jun 27, 2022