posttrack/services/__init__.py

14 lines
467 B
Python

import importlib
SERVICES = ["austrianpost"]
def get_status(trackingnumber, service=None, *args, **kwargs):
if not service:
raise NotImplementedError("Auto-discovery of courier service is not yet supported.")
if not service in SERVICES:
raise NotImplementedError("Service %s is not supported." % service)
handler = importlib.import_module("services.%s" % service)
return handler.service(*args, **kwargs).get_status(trackingnumber)