()
| 13 | |
| 14 | |
| 15 | def get_current_ip(): |
| 16 | global __CURRENT_IP__ |
| 17 | if __CURRENT_IP__: |
| 18 | # logger.debug('get_current_ip from cache') |
| 19 | return __CURRENT_IP__ |
| 20 | else: |
| 21 | # logger.debug('fetch current_ip') |
| 22 | r = requests.get(IP_CHECKER_API) |
| 23 | j = json.loads(r.text) |
| 24 | __CURRENT_IP__ = j['ip'] |
| 25 | return __CURRENT_IP__ |
| 26 | |
| 27 | |
| 28 | class Validator(object): |