Python bindings to efidgy services.
Project description
efidgy
Python bindings to efidgy services.
Read more at https://efidgy.com/docs
Sample usage:
export EFIDGY_CUSTOMER_CODE=code # https://console.efidgy.com/profile/company
export EFIDGY_ACCESS_TOKEN=token # https://console.efidgy.com/profile/tokens
import datetime
import efidgy
project = efidgy.models.Project.create(
name='Demo',
currency='USD',
project_type=efidgy.models.ProjectType(
code=efidgy.models.ProjectTypeCode.IDD_OR,
),
shared_mode=efidgy.models.SharedMode.PRIVATE,
)
store_address = '6133 Broadway Terr., Oakland, CA 94618, USA'
lat, lon = efidgy.tools.geocode(store_address)
store = efidgy.models.idd_or.Store.create(
project=project,
address=store_address,
lat=lat,
lon=lon,
name='Delivery Inc.',
open_time=datetime.time(8, 0),
close_time=datetime.time(18, 0),
)
vehicle = efidgy.models.idd_or.Vehicle.create(
project=project,
store=store,
name='Gary Bailey',
fuel_consumption=11.76,
fuel_price=3.25,
salary_per_duration=21,
duration_limit=datetime.timedelta(hours=9),
)
order_address = '1 Downey Pl, Oakland, CA 94610, USA'
lat, lon = efidgy.tools.geocode(order_address)
order = efidgy.models.idd_or.Order.create(
project=project,
store=store,
name='#00001',
address=order_address,
lat=lat,
lon=lon,
ready_time=datetime.time(8, 0),
delivery_time_from=datetime.time(12, 0),
delivery_time_to=datetime.time(16, 0),
load_duration=datetime.timedelta(minutes=1),
unload_duration=datetime.timedelta(minutes=5),
boxes=1,
volume=3.53,
weight=22.05,
)
project.computate()
solutions = efidgy.models.Solution.all(
project=project,
)
if solutions:
solution = solutions[0]
vehicle = efidgy.models.idd_or.Vehicle.get(
pk=vehicle.pk,
project=project,
solution=solution,
)
print(vehicle.name)
if vehicle.route is not None:
prev_schedule = None
for schedule in vehicle.route.schedule:
print('{at}\t{arr}\t{dep}'.format(
at=schedule.start_point.name,
arr=prev_schedule.arrival_time if prev_schedule else '',
dep=schedule.departure_time,
))
prev_schedule = schedule
if prev_schedule:
print('{at}\t{arr}\t{dep}'.format(
at=prev_schedule.end_point.name,
arr=prev_schedule.arrival_time,
dep='',
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
efidgy-0.12.post1.tar.gz
(24.9 kB
view hashes)
Built Distribution
Close
Hashes for efidgy-0.12.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f71f26f63ad6bcc68596b05a80470d2191f07712c67843b2569c026229bdc0b4 |
|
MD5 | d8b5b4d6d5adeddb271489142f6b201f |
|
BLAKE2b-256 | 2255992210a4ca6c0ed84ccfc49d3738ad6c1898bdf661b8a6fb89839c2f5b8c |