How to use pop_host method in autotest

Best Python code snippet using autotest_python

info.py

Source:info.py Github

copy

Full Screen

1"""2zmail.info3~~~~~~~~~~4This module provide supported server information.5'Server_provider_address':{6 'protocol':('protocol_server_address', port, use_ssl,use_tls),7}8"""9from typing import Optional10SUPPORTED_SERVER = {11 '163.com': {12 'smtp_host': 'smtp.163.com',13 'smtp_port': 994,14 'smtp_ssl': True,15 'smtp_tls': False,16 'pop_host': 'pop.163.com',17 'pop_port': 995,18 'pop_ssl': True,19 'pop_tls': False,20 'imap_host': 'imap.163.com',21 'imap_port': 993,22 'imap_ssl': True,23 'imap_tls': False24 },25 '126.com': {26 'smtp_host': 'smtp.126.com',27 'smtp_port': 994,28 'smtp_ssl': True,29 'smtp_tls': False,30 'pop_host': 'pop.126.com',31 'pop_port': 995,32 'pop_ssl': True,33 'pop_tls': False,34 'imap_host': 'imap.126.com',35 'imap_port': 993,36 'imap_ssl': True,37 'imap_tls': False38 },39 'yeah.net': {40 'smtp_host': 'smtp.yeah.net',41 'smtp_port': 994,42 'smtp_ssl': True,43 'smtp_tls': False,44 'pop_host': 'pop.yeah.net',45 'pop_port': 995,46 'pop_ssl': True,47 'pop_tls': False,48 'imap_host': 'imap.yeah.net',49 'imap_port': 993,50 'imap_ssl': True,51 'imap_tls': False52 },53 'qq.com': {54 'smtp_host': 'smtp.qq.com',55 'smtp_port': 465,56 'smtp_ssl': True,57 'smtp_tls': False,58 'pop_host': 'pop.qq.com',59 'pop_port': 995,60 'pop_ssl': True,61 'pop_tls': False,62 },63 'gmail.com': {64 'smtp_host': 'smtp.gmail.com',65 'smtp_port': 587,66 'smtp_ssl': False,67 'smtp_tls': True,68 'pop_host': 'pop.gmail.com',69 'pop_port': 995,70 'pop_ssl': True,71 'pop_tls': False,72 },73 'sina.com': {74 'smtp_host': 'smtp.sina.com',75 'smtp_port': 465,76 'smtp_ssl': True,77 'smtp_tls': False,78 'pop_host': 'pop.sina.com',79 'pop_port': 995,80 'pop_ssl': True,81 'pop_tls': False,82 },83 'outlook.com': {84 'smtp_host': 'smtp-mail.outlook.com',85 'smtp_port': 587,86 'smtp_ssl': False,87 'smtp_tls': True,88 'pop_host': 'pop.outlook.com',89 'pop_port': 995,90 'pop_ssl': True,91 'pop_tls': False,92 },93 'hotmail.com': {94 'smtp_host': 'smtp.office365.com',95 'smtp_port': 587,96 'smtp_ssl': False,97 'smtp_tls': True,98 'pop_host': 'outlook.office365.com',99 'pop_port': 995,100 'pop_ssl': True,101 'pop_tls': False,102 },103}104SUPPORTED_ENTERPRISE_SERVER_CONFIG = {105 'qq': {106 'smtp_host': 'smtp.exmail.qq.com',107 'smtp_port': 465,108 'smtp_ssl': True,109 'smtp_tls': False,110 'pop_host': 'pop.exmail.qq.com',111 'pop_port': 995,112 'pop_ssl': True,113 'pop_tls': False114 },115 'ali': {116 'smtp_host': 'smtp.mxhichina.com',117 'smtp_port': 465,118 'smtp_ssl': True,119 'smtp_tls': False,120 'pop_host': 'pop3.mxhichina.com',121 'pop_port': 995,122 'pop_ssl': True,123 'pop_tls': False124 },125 '163': {126 'smtp_host': 'smtp.qiye.163.com',127 'smtp_port': 994,128 'smtp_ssl': True,129 'smtp_tls': False,130 'pop_host': 'pop.qiye.163.com',131 'pop_port': 995,132 'pop_ssl': True,133 'pop_tls': False134 },135}136DEFAULT_SERVER_CONFIG = {137 'smtp_host': 'smtp.',138 'smtp_port': 465,139 'smtp_ssl': True,140 'smtp_tls': False,141 'pop_host': 'pop.',142 'pop_port': 995,143 'pop_ssl': True,144 'pop_tls': False,145 'imap_host': 'imap.',146 'imap_port': 993,147 'imap_ssl': True,148 'imap_tls': False149}150def get_supported_server_info(mail_address: str, config: Optional[str] = None) -> dict:151 """Use user address to get server address and port."""152 provider = mail_address.split('@')[1]153 if config is not None:154 if config in SUPPORTED_ENTERPRISE_SERVER_CONFIG:155 return SUPPORTED_ENTERPRISE_SERVER_CONFIG[config]156 else:157 raise RuntimeError('Can not this config "{}".'.format(config))158 if provider in SUPPORTED_SERVER:159 return SUPPORTED_SERVER[provider]160 else:161 # Return default configs.162 config = DEFAULT_SERVER_CONFIG.copy()163 config['smtp_host'] += provider164 config['pop_host'] += provider165 config['imap_host'] += provider...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful