(host)
| 35 | |
| 36 | |
| 37 | def get_ip(host): |
| 38 | if host in ['localhost', '127.0.0.1']: |
| 39 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
| 40 | try: |
| 41 | sock.connect(('10.255.255.255', 1)) |
| 42 | host = sock.getsockname()[0] |
| 43 | except RuntimeError: |
| 44 | pass |
| 45 | finally: |
| 46 | sock.close() |
| 47 | return host |
| 48 | |
| 49 | |
| 50 | def find_weather_presets(): |