本文整理匯總了Python中importer.Importer.loadRBLList方法的典型用法代碼示例。如果您正苦於以下問題:Python Importer.loadRBLList方法的具體用法?Python Importer.loadRBLList怎麽用?Python Importer.loadRBLList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類importer.Importer
的用法示例。
在下文中一共展示了Importer.loadRBLList方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Importer
# 需要導入模塊: from importer import Importer [as 別名]
# 或者: from importer.Importer import loadRBLList [as 別名]
import json
from time import strptime, mktime
from datetime import datetime
import dateutil.parser
from numpy import mean, sqrt, square, arange
from importer import Importer
from csvimporter import CSVImporter
from model import RMSDelay, RMSDelayEncoder
# time_format = "%Y-%m-%dT%H:%M:%S.%f+0100"
i = Importer()
i.loadRBLList()
print "Will now call Importer.request()..."
try:
monitors = i.request()
request_time = datetime.now()
except:
print "ERROR: Could not issue request to WL!"
raise
exit(0)
# print json.dumps(message)
# message = json.loads("{\"message\": {\"messageCode\": 1, \"serverTime\": \"2014-11-19T11:34:41.870+0100\", \"value\": \"OK\"}, \"data\": {\"monitors\": [{\"locationStop\": {\"geometry\": {\"type\": \"Point\", \"coordinates\": [16.349198741357, 48.2249564556775]}, \"type\": \"Feature\", \"properties\": {\"name\": \"60201510\", \"title\": \"W\u00e4hringer Stra\u00dfe-Volksoper\", \"municipality\": \"Wien\", \"municipalityId\": 90000, \"coordName\": \"WGS84\", \"attributes\": {\"rbl\": 147}, \"type\": \"stop\"}}, \"lines\": [{\"direction\": \"R\", \"towards\": \"Schottentor U\", \"name\": \"40\", \"richtungsId\": \"1\", \"trafficjam\": false, \"departures\": {\"departure\": [{\"departureTime\": {\"timePlanned\": \"2014-11-19T11:41:00.000+0100\", \"countdown\": 7, \"timeReal\": \"2014-11-19T11:42:21.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T11:48:00.000+0100\", \"countdown\": 13, \"timeReal\": \"2014-11-19T11:48:30.000+0100\"}, \"vehicle\": {\"direction\": \"R\", \"towards\": \"Schottentor U\", \"name\": \"40\", \"linienId\": 140, \"richtungsId\": \"1\", \"trafficjam\": false, \"barrierFree\": true, \"realtimeSupported\": true, \"type\": \"ptTram\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T11:56:00.000+0100\", \"countdown\": 21, \"timeReal\": \"2014-11-19T11:56:00.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:03:00.000+0100\", \"countdown\": 28, \"timeReal\": \"2014-11-19T12:03:30.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:11:00.000+0100\", \"countdown\": 36, \"timeReal\": \"2014-11-19T12:11:00.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:18:00.000+0100\", \"countdown\": 43, \"timeReal\": \"2014-11-19T12:18:30.000+0100\"}, \"vehicle\": {\"direction\": \"R\", \"towards\": \"Schottentor U\", \"name\": \"40\", \"linienId\": 140, \"richtungsId\": \"1\", \"trafficjam\": false, \"barrierFree\": true, \"realtimeSupported\": true, \"type\": \"ptTram\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:26:00.000+0100\", \"countdown\": 51, \"timeReal\": \"2014-11-19T12:26:00.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:33:00.000+0100\", \"countdown\": 58, \"timeReal\": \"2014-11-19T12:33:30.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:41:00.000+0100\", \"countdown\": 66}}]}, \"barrierFree\": false, \"realtimeSupported\": true, \"lineId\": 140, \"type\": \"ptTram\"}]}, {\"locationStop\": {\"geometry\": {\"type\": \"Point\", \"coordinates\": [16.349198741357, 48.2249564556775]}, \"type\": \"Feature\", \"properties\": {\"name\": \"60201510\", \"title\": \"W\u00e4hringer Stra\u00dfe-Volksoper\", \"municipality\": \"Wien\", \"municipalityId\": 90000, \"coordName\": \"WGS84\", \"attributes\": {\"rbl\": 147}, \"type\": \"stop\"}}, \"lines\": [{\"direction\": \"R\", \"towards\": \"Schottentor U\", \"name\": \"41\", \"richtungsId\": \"1\", \"trafficjam\": false, \"departures\": {\"departure\": [{\"departureTime\": {\"timePlanned\": \"2014-11-19T11:37:00.000+0100\", \"countdown\": 2, \"timeReal\": \"2014-11-19T11:37:30.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T11:45:00.000+0100\", \"countdown\": 9, \"timeReal\": \"2014-11-19T11:44:26.000+0100\"}, \"vehicle\": {\"direction\": \"R\", \"towards\": \"Schottentor U\", \"name\": \"41\", \"linienId\": 141, \"richtungsId\": \"1\", \"trafficjam\": false, \"barrierFree\": true, \"realtimeSupported\": true, \"type\": \"ptTram\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T11:52:00.000+0100\", \"countdown\": 17, \"timeReal\": \"2014-11-19T11:52:30.000+0100\"}, \"vehicle\": {\"direction\": \"R\", \"towards\": \"Schottentor U\", \"name\": \"41\", \"linienId\": 141, \"richtungsId\": \"1\", \"trafficjam\": false, \"barrierFree\": true, \"realtimeSupported\": true, \"type\": \"ptTram\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:00:00.000+0100\", \"countdown\": 25, \"timeReal\": \"2014-11-19T12:00:00.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:07:00.000+0100\", \"countdown\": 32, \"timeReal\": \"2014-11-19T12:07:30.000+0100\"}, \"vehicle\": {\"direction\": \"R\", \"towards\": \"Schottentor U\", \"name\": \"41\", \"linienId\": 141, \"richtungsId\": \"1\", \"trafficjam\": false, \"barrierFree\": true, \"realtimeSupported\": true, \"type\": \"ptTram\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:15:00.000+0100\", \"countdown\": 40, \"timeReal\": \"2014-11-19T12:15:00.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:22:00.000+0100\", \"countdown\": 47, \"timeReal\": \"2014-11-19T12:22:30.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:30:00.000+0100\", \"countdown\": 55, \"timeReal\": \"2014-11-19T12:30:00.000+0100\"}}, {\"departureTime\": {\"timePlanned\": \"2014-11-19T12:37:00.000+0100\", \"countdown\": 62}}]}, \"barrierFree\": false, \"realtimeSupported\": true, \"lineId\": 141, \"type\": \"ptTram\"}]}]}}")
print "Numbers of monitors received: ", len(monitors)
delays = list()