Break fix
This commit is contained in:
parent
f1a12892f6
commit
8111c5a164
1 changed files with 21 additions and 4 deletions
25
server.py
25
server.py
|
@ -173,17 +173,18 @@ def function_getPlanForDay(number, year, month, day):
|
|||
return defaultPlan[0]
|
||||
|
||||
def function_updateAccountsAtFunk():
|
||||
print("Send Updates to Funk")
|
||||
accounts = function_getAccounts(True)
|
||||
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:
|
||||
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
|
||||
planedPlan = function_getPlanForDay(account["number"], tomorrow.year, tomorrow.month, tomorrow.day)
|
||||
plan = getCurrentPlan(api, tomorrow)
|
||||
if(plan["productServiceId"] == planedPlan):
|
||||
print("Nothing to Change, plan already set")
|
||||
else:
|
||||
print("Update")
|
||||
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")
|
||||
|
@ -195,6 +196,22 @@ def function_updateAccountsAtFunk():
|
|||
print("Switch to break")
|
||||
else:
|
||||
print("Cant update plan!!! ERROR")
|
||||
else:
|
||||
if(plan["productServiceId"] == planedPlan):
|
||||
print("Nothing to Change, plan already set")
|
||||
else:
|
||||
print("Update")
|
||||
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")
|
||||
|
||||
#Routes
|
||||
@app.route("/")
|
||||
|
|
Loading…
Reference in a new issue