retrieve current ip
(self)
| 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): |
no test coverage detected