Ejemplo n.º 1
0
 def onStateLobby(self):
     trace('onStateLobby')
     try:
         accountDBID = getCurrentAccountDBID()
         if accountDBID is not None and self.currentAccountDBID != accountDBID:
             self.currentAccountDBID = accountDBID
             config.token = config.XvmServicesToken({'accountDBID':accountDBID})
             config.token.saveLastAccountDBID()
             self.xvmServicesInitialized = False
             self.initializeXvmServices()
         reserve.init(self.currentAccountDBID)
     except Exception, ex:
         err(traceback.format_exc())
Ejemplo n.º 2
0
def run():
    r = requests.post('https://irentcar-app.azurefd.net/api/AnyRent',
                      json=dataiRent,
                      headers=header,
                      verify=False)
    data = json.loads(r.text)
    data = data['Data']['AnyRentObj']
    if len(data) > 0:
        print('有車囉')
        sent_message = "附近" + str(radius) + "公里內有車囉,有以下車號:" + "\n"
        for car in data:
            sent_message += car['CarNo'] + "\n"
        send_notice('notify', sent_message)
        # 自動預約
        reserve.init(data[0]['CarNo'])
    else:
        s.enter(10, 0, run)
Ejemplo n.º 3
0
 def onStateLogin(self):
     trace('onStateLogin')
     if self.currentAccountDBID is not None:
         self.currentAccountDBID = None
         config.token = config.XvmServicesToken()
     reserve.init(None)