Lazy loading for performance, possibly

This commit is contained in:
Alexandre Aubin 2020-04-19 02:59:16 +02:00
parent da112a3668
commit f78af06a35

View file

@ -27,8 +27,6 @@
import re
import os
import time
import requests
import socket
from moulinette import m18n, msettings
from moulinette.utils import log
@ -496,6 +494,10 @@ class Diagnoser():
@staticmethod
def remote_diagnosis(uri, data, ipversion, timeout=30):
# Lazy loading for performance
import requests
import socket
# Monkey patch socket.getaddrinfo to force request() to happen in ipv4
# or 6 ...
# Inspired by https://stackoverflow.com/a/50044152