I have two network interfaces (wifi and ethernet) both with internet access. Let\'s say my interfaces are eth
(ethernet) and wlp2
(wifi). I need sp
Try changing the internal IP (192.168.0.200) to the corresponding iface in the code below.
import requests
from requests_toolbelt.adapters import source
def check_ip(inet_addr):
s = requests.Session()
iface = source.SourceAddressAdapter(inet_addr)
s.mount('http://', iface)
s.mount('https://', iface)
url = 'https://emapp.cc/get_my_ip'
resp = s.get(url)
print(resp.text)
if __name__ == '__main__':
check_ip('192.168.0.200')