Closed DonaldSeo1 closed 4 years ago
btw this is part of the Appium Automation test script that I am trying to run in AWS device farm (email parsing is part of the task that's required in Appium automation script)
using 2.1.0 version of imapclient
It's likely that the standard root certificate store isn't installed in the cloud environment you're using.
If the AWS instances you're using are based on Ubuntu you can install these root certificates by installing the ca-certificates package (apt install ca-certificates
). Other operating systems make these root certs available as a standard package too (the name varies).
If that isn't possible for some reason, you can also use the certfi package to make the standard root certificates available to your program. See the IMAPClient docs for more details: https://imapclient.readthedocs.io/en/2.1.0/concepts.html#tls-ssl
If none of the above works you can turn off certificate verification by passing a custom SSLContext but I really recommend against that. See the docs in the standard library: https://docs.python.org/3/library/ssl.html#ssl.SSLContext
Closing this as this issue is outside of IMAPClient's scope.
Hi,
Im using imapclient for connecting to my gmail and parsing email content with bs4.
my script works on my local machine, but when I run it on AWS device farm, it returns the following error
Info about AWS device farm machine
platform linux -- Python 3.7.4
common/email_parser.py:12: in parse_email_for with IMAPClient(host="imap.gmail.com") as client: lib/python3.7/site-packages/imapclient/imapclient.py:254: in __init__ self._imap = self._create_IMAP4() lib/python3.7/site-packages/imapclient/imapclient.py:289: in _create_IMAP4 self._timeout) lib/python3.7/site-packages/imapclient/tls.py:44: in __init__ imaplib.IMAP4.__init__(self, host, port) /usr/local/lib/python3.7/imaplib.py:198: in __init__ self.open(host, port) lib/python3.7/site-packages/imapclient/tls.py:50: in open self.sock = wrap_socket(sock, self.ssl_context, host) lib/python3.7/site-packages/imapclient/tls.py:32: in wrap_socket return ssl_context.wrap_socket(sock, server_hostname=host) /usr/local/lib/python3.7/ssl.py:423: in wrap_socket session=session /usr/local/lib/python3.7/ssl.py:870: in _create self.do_handshake()
`self = <ssl.SSLSocket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6> block = False/usr/local/lib/python3.7/ssl.py:1139: SSLCertVerificationError`
I've tried passing in ssl=False to see if that solve the issue but it did not.
Thank you for reading this post.