- fan """ import oftest.base_tests as base_tests import config as test_config import requests import auth URL = test_config.API_BASE_URL LOGIN = test_config.LOGIN AUTH_TOKEN = 'BASIC ' + LOGIN # GET_HEADER = {'Authorization': AUTH_TOKEN} # POST_HEADER = {'Authorization': AUTH_TOKEN, 'Content-Type': 'application/json'} GET_HEADER = {'Accept': 'application/json'} POST_HEADER = {'Content-Type': 'application/json'} COOKIES = auth.Authentication().login().get_cookies() class ControllerCpu(base_tests.SimpleDataPlane): """ Test HealthyCheck Controller CPU Threshold RestAPI - GET /healthycheck/v1/controller/cpu/threshold - POST /healthycheck/v1/controller/cpu/threshold - GET /healthycheck/v1/controller/cpu/threshold/<rule_name> - DELETE /healthycheck/v1/controller/cpu/threshold/<rule_name> """ def setUp(self): pass def tearDown(self): pass
import auth # if database requires authentication use username and password instead of None, None newAuth = auth.Authentication('localhost', 27017, 'test-db', None, None) if __name__ == '__main__': if newAuth.reg("Himanshu", "*****@*****.**", "7042856750", "password"): print("User Created") else: print("User Creation Error") if newAuth.login("7042856750", "password"): print("Login Successful") else: print("Login Failed") def __init__(self): Gtk.Window.__init__(self, title="Equipment Details Form") self.set_border_width(10) self.set_default_size(850, 300) self.hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) self.vbox_left = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5) self.vbox_right = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5) self.hbox.pack_start(self.vbox_left, True, True, 0)
cfgfile = '/etc/nersc_sdn.conf' if 'SDN_SETTINGS' in os.environ: cfgfile = os.environ['SDN_SETTINGS'] if os.path.exists(cfgfile): application.logger.info("Loading settings from " + cfgfile) application.config.from_pyfile(cfgfile) application.logger.debug(application.config) router = router.Router(application.config) auth_mode = application.config['AUTHMODE'] auth_handler = auth.Authentication({'authentication': auth_mode}) AUTH_HEADER = 'authentication' def shutdown(): router.shutdown() @application.route("/") def hello(): return "/{associate,release}" def is_allowed(session): if 'uid' not in session: return False
import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.application import MIMEApplication import auth import datetime import os newAuth = auth.Authentication("localhost", 27017, 'user_database', None, None) def send_reminder(): assign = auth.Assign.objects.all_fields() for i in range(0, assign.__len__()): person = assign[i].assign equip = assign[i].equip_name owner = assign[i].owner code = assign[i].code date = assign[i].next_date year = int(date[0:4]) month = int(date[5:7]) day = int(date[8:]) entered_date = datetime.date(year, month, day) date = entered_date reminder = int(assign[i].reminder) task = assign[i].task loc = assign[i].loc sub_loc = assign[i].sub_loc section = assign[i].section