MCPcopy Index your code
hub / github.com/pyload/pyload / getIP

Method getIP

module/ThreadManager.py:212–228  ·  view source on GitHub ↗

retrieve current ip

(self)

Source from the content-addressed store, hash-verified

210 self.reconnecting.clear()
211
212 def getIP(self):
213 """retrieve current ip"""
214 services = [("http://automation.whatismyip.com/n09230945.asp", "(\S+)"),
215 ("http://checkip.dyndns.org/",".*Current IP Address: (\S+)</body>.*")]
216
217 ip = ""
218 for i in range(10):
219 try:
220 sv = choice(services)
221 ip = getURL(sv[0])
222 ip = re.match(sv[1], ip).group(1)
223 break
224 except:
225 ip = ""
226 sleep(1)
227
228 return ip
229
230 #----------------------------------------------------------------------
231 def checkThreadCount(self):

Callers 1

tryReconnectMethod · 0.95

Calls 2

getURLFunction · 0.90
matchMethod · 0.45

Tested by

no test coverage detected