Skip to content

Commit c568c2f

Browse files
committedApr 14, 2022
Add force update with timeout ft param
1 parent a3bcb8f commit c568c2f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎freemyip.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def print_log(log_file):
133133
output += '===== \n\x1b[6;30;42mShow log is completed!\x1b[0m'
134134
print(output)
135135
def printHelp():
136-
return "[Command] [Param]\n\nParameters:\n\n\tlog: Display log.\n\n\tlogpath: Display log file path.\n\n\tt=X: Use custom connection timeout where X must be an integer represents the timeout in milliseconds, ex: t=35.\n\n\tf: Force update i.e. update even the last update time does not exceed the limit and the IP does not has changed.\n\n\th: Display this help message."
136+
return "[Command] [Param]\n\nParameters:\n\n\tlog: Display log.\n\n\tlogpath: Display log file path.\n\n\tt=X: Use custom connection timeout where X must be an integer represents the timeout in milliseconds, ex: t=35.\n\n\tf: Force update i.e. update even the last update time does not exceed the limit and the IP does not has changed.\n\n\tft: Force update with timeout. ex: ft=35.\n\n\th: Display this help message."
137137

138138
#Executing the script
139139
def exec():
@@ -152,14 +152,23 @@ def exec():
152152
print('Log file path:\n')
153153
print(os.getcwd()+os.sep+log_file)
154154
exit()
155-
elif 't=' in param:
155+
elif 't=' in param and 'ft=' not in param:
156156
t = param[2:]
157157
try:
158158
t = int(t)
159159
except:
160160
print ('Timeout value is not integer')
161161
exit()
162162
timeout = t
163+
elif 'ft=' in param:
164+
t = param[3:]
165+
try:
166+
t = int(t)
167+
except:
168+
print ('Timeout value is not integer')
169+
exit()
170+
timeout = t
171+
forceUpdate = True
163172
elif param == 'h':
164173
print(printHelp())
165174
exit()

0 commit comments

Comments
 (0)