Best Python code snippet using sure_python
netapp_register.py
Source:netapp_register.py
...25def get_site_data():26 return client.EcxAPI(session, 'site').list()27def get_user_data():28 return client.EcxAPI(session, 'identityuser').list()29def register_providers(providers, sites, users):30 for provider in providers:31 registration = {}32 registration['name'] = provider['name']33 registration['hostAddress'] = provider['host']34 registration['portNumber'] = int(provider['port'])35 if registration['portNumber'] == 80:36 registration['sslConnection'] = False37 else:38 registration['sslConnection'] = True39 registration['addToCatJob'] = True40 registration['startCatalog'] = False41 for site in sites:42 if provider['site'].upper() == site['name'].upper():43 registration['siteId'] = site['id']44 for user in users:45 if provider['user'].upper() == user['name'].upper():46 registration['user'] = {}47 registration['user']['href'] = user['links']['self']['href']48 try:49 client.EcxAPI(session, '').post(path='netapp',data=registration)50 except:51 print "Failed to register the provider"52 prettyprint(registration)53def run():54 session.login()55 providers = read_csv_into_list()56 sites = get_site_data()57 users = get_user_data()58 register_providers(providers, sites, users)59 session.delete('endeavour/session/')...
factory.py
Source:factory.py
...21 self.model_registry = {}22 self.main_blueprint = None23 self.pages_blueprint = None24 def setup_from_settings(self):25 self.register_providers()26 for k, b in self.topic_blueprints.items():27 self.flask.register_blueprint(b, url_prefix='/topic/{}'.format(k))28 self.main_blueprint = import_string('mailmove.views.mod')29 self.flask.register_blueprint(self.main_blueprint, url_prefix='/mailmove')30 if self.config.get('ADD_BLUEPRINTS', False):31 for prefix, bp_name in self.config['ADD_BLUEPRINTS'].items():32 blueprint = import_string(bp_name)33 self.flask.register_blueprint(blueprint, url_prefix=prefix)34 def register_topic(self, name, blueprint, model):35 self.topic_blueprints[name] = blueprint36 self.model_registry[name] = dict(model=model)37 def register_providers(self):38 for provider in self.config.get('PROVIDERS', []):39 provider_mod = importlib.import_module(provider)40 provider_mod.register(self)41 def register_provider(self, topic, name, model):...
__init__.py
Source:__init__.py
1# encoding: utf-82from __future__ import unicode_literals3import importlib4from django.conf import settings5def register_providers():6 """Registers all providers which are declared in settings"""7 providers = {}8 assert hasattr(settings, 'SOCIAL_PROVIDERS'), (9 'SOCIAL_PROVIDERS is not declared in settings'10 )11 for name in settings.SOCIAL_PROVIDERS:12 if name not in providers:13 module = importlib.import_module('.{}'.format(name), __package__)14 providers[name] = module.Provider(name)15 return providers...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!