Best Python code snippet using localstack_python
userpassvalidator.py
Source:userpassvalidator.py
...490 #491 # Blueprint Section492 #493 def routes(self, blueprint):494 blueprint.add_url_rule(rule=self.get_url_config('LOGIN'), endpoint='login', view_func=self.login_view, methods=['GET', 'POST'])495 blueprint.add_url_rule(rule=self.get_url_config('REGISTER'), endpoint='register', view_func=self.register_view, methods=['GET', 'POST'])496 blueprint.add_url_rule(rule=self.get_url_config('LOGOUT'), endpoint='logout', view_func=self.logout_view, methods=['GET', 'POST'])497 blueprint.add_url_rule(rule=self.get_url_config('CHANGE_PASS'), endpoint='change_password', view_func=self.change_pass_view, methods=['GET', 'POST'])498 blueprint.add_url_rule(rule=self.get_url_config('FORGOT_PASS'), endpoint='forgot_password', view_func=self.forgot_pass_view, methods=['GET', 'POST'])499 blueprint.add_url_rule(rule=self.get_url_config('RESET_PASS')+'/<string:reset_code>', endpoint='reset_password', view_func=self.reset_pass_view, methods=['GET', 'POST'])500 #blueprint.add_url_rule(rule=self.get_url_config('CONFIRM_EMAIL')+'/<string:confirm_code>', endpoint='confirm_email', view_func=self.confirm_email_view, methods=['GET', 'POST'])501 def initialize(self, app, blueprint, **kwargs):502 super().initialize(app, blueprint, **kwargs)503 if not app.extensions.get('mail'):504 self._config['SEND_EMAIL']=False505 def get_defaults(self):506 return self.__DEFAULT_CONFIG507 def get_url_config(self, key):508 return self.get_config('URLS')[key]509 def get_action_config(self, key):510 return self.get_config('ACTIONS')[key]511 def get_form_config(self, key):512 return self.get_config('FORMS')[key]513 def get_form_field_config(self, key):514 return self.get_config('FORM_FIELDS')[key]515 def get_msg_config(self, key):516 return self.get_config('MSGS')[key]517 def get_template_config(self, key):518 return self.get_config('TEMPLATES')[key]519 def get_redirect_config(self, key):520 return self.get_config('REDIRECT')[key]521 def get_user_field(self, key):...
app.py
Source:app.py
...33class get_all_configs(Resource):34 @auth.login_required35 def get(self):36 return jsonify([{"url": k["url"],"regex": k["regex"]} for k in config["proxy_gather"]["web_sites"]])37class get_url_config(Resource):38 @auth.login_required39 def get(self):40 url=request.args.get('url').strip()41 if url[-1]!="/":42 url+="/"43 for k in config["proxy_gather"]["web_sites"]:44 if k["url"]==url:45 return jsonify({"url": k["url"],"regex": k["regex"]})46 return jsonify(None)47class update_config(Resource):48 @auth.login_required49 def post(self):50 configuration=request.get_json()51 for k in config["proxy_gather"]["web_sites"]:...
main.py
Source:main.py
2import requests3import uuid4# from getmac import get_mac_address5def run(userId):6 # url = get_url_config()7 mac_address = get_mac_address()8 mac_address = mac_address.upper()9 print(mac_address, '===============')10 # mac_address = '00:0C:29:21:5C:D9'11 params = {'userid': userId, 'mac_address': mac_address}12 r = requests.get(url='https://erp.suffescom.com/modules/access/api', params=params)13 json = r.json()14 try:15 result = MainController.action_controller(json)16 if result is None or result == "image_search_complete":17 result = "Finished"18 elif result == "image_search_complete_not_found":19 result = "Please don't touch mouse/keyboard when app is running"20 return result21 except Exception as e:22 return e23def get_url_config():24 f = open("API_Config.txt", "r")25 if f.mode == 'r':26 url = f.read()27 return url28def get_mac_address():29 mac_hex = iter(hex(uuid.getnode())[2:].zfill(12))30 mac = ":".join(i + next(mac_hex) for i in mac_hex)...
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!!