Currently I am using RHEL8 server which has not internet connection to it. In that server I have implemented a Jupyter notebook and I have used following code to connect with IMAP.
import imaplib
imap = imaplib.IMAP4_SSL('imap-mail.outlook.com',995)
# authenticate
imap.login(username, password)
imap.select()
I am having following error.
OSError: [Errno 97] Address family not supported by protocol
Can someone explain whether this error is occurring due to unavailability of internet or any other reason? How should I create a proxy and pass this through it?
Here I have implemented a proxy and checked the connectivity as follows. Now I need to connect this to IMAP. But I couldn't identify the correct method to do that.
http_proxy = "http://10.48.250.90:3128"
https_proxy = "https://10.48.250.90:3128"
ftp_proxy = "ftp://10.48.250.90:3128"
proxyDict = {
"http" : http_proxy,
"https" : https_proxy,
"ftp" : ftp_proxy
}
# setting up the URL and checking the conection by printing the status
url = "https://imap-mail.outlook.com"
#url = 'https://www.google.lk'
page = requests.get(url, proxies=proxyDict)
print(page.status_code)
print(page.url)
#print(page.text)