import json
import requests
url = 'https://www.baidu.com'
with open('proxiex.txt', 'r', encoding='utf-8') as f:
data = json.loads(f.read())
proxy = {
'https': data['https']
}
resp = requests.get(url, stream=True, proxies=proxy)
ip_and_port = resp.raw._connection.sock.getpeername()
print(resp.text)
print(ip_and_port)