Break fix
This commit is contained in:
parent
f1a12892f6
commit
8111c5a164
1 changed files with 21 additions and 4 deletions
17
server.py
17
server.py
|
@ -173,13 +173,30 @@ def function_getPlanForDay(number, year, month, day):
|
||||||
return defaultPlan[0]
|
return defaultPlan[0]
|
||||||
|
|
||||||
def function_updateAccountsAtFunk():
|
def function_updateAccountsAtFunk():
|
||||||
|
print("Send Updates to Funk")
|
||||||
accounts = function_getAccounts(True)
|
accounts = function_getAccounts(True)
|
||||||
tomorrow = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=1)
|
tomorrow = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=1)
|
||||||
|
today = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=1)
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
api = FunkAPI(account["mail"], account["password"])
|
api = FunkAPI(account["mail"], account["password"])
|
||||||
function_updateAccount(account["number"], api) # We already have the API with the Data, so we can write them in the update table
|
function_updateAccount(account["number"], api) # We already have the API with the Data, so we can write them in the update table
|
||||||
planedPlan = function_getPlanForDay(account["number"], tomorrow.year, tomorrow.month, tomorrow.day)
|
planedPlan = function_getPlanForDay(account["number"], tomorrow.year, tomorrow.month, tomorrow.day)
|
||||||
plan = getCurrentPlan(api, tomorrow)
|
plan = getCurrentPlan(api, tomorrow)
|
||||||
|
currentPlan = getCurrentPlan(api)
|
||||||
|
if currentPlan == 42:
|
||||||
|
planedPlan = function_getPlanForDay(account["number"], today.year, today.month, today.day)
|
||||||
|
if planedPlan == "8": #Change to unlimit
|
||||||
|
api.orderUnlimitedPlan()
|
||||||
|
print("Switch to Unlimit")
|
||||||
|
elif planedPlan == "9": #Change to 1GB
|
||||||
|
api.order1GBPlan()
|
||||||
|
print("Switch to 1GB")
|
||||||
|
elif planedPlan == "42": #Change to break
|
||||||
|
api.startPause()
|
||||||
|
print("Switch to break")
|
||||||
|
else:
|
||||||
|
print("Cant update plan!!! ERROR")
|
||||||
|
else:
|
||||||
if(plan["productServiceId"] == planedPlan):
|
if(plan["productServiceId"] == planedPlan):
|
||||||
print("Nothing to Change, plan already set")
|
print("Nothing to Change, plan already set")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue