def main(dataPath="data"): events = [] for root, dirs, files in os.walk(dataPath): for fileName in [os.path.join(root, f) for f in files]: fileExtension = os.path.splitext(os.path.basename(fileName))[1].lower() backend = getCalendarBackend(fileExtension.strip(".")) if backend: cal = backend(fileName, dataPath) if cal.events: events.extend(cal.events) print("Loaded {0} events.".format(len(events))) server.startServer(events)
def createGuard(): pid = os.fork() if pid > 0: os._exit(0) else: os.chdir('.') os.setsid() os.umask(0) pid = os.fork() if pid > 0: os._exit(0) else: signal.signal(signal.SIGCHLD, signal.SIG_IGN) server.startServer() httpServerPid = httpserver.startDownloadServer() startExitSignalWatcher(httpServerPid)
def main(): abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) os.chdir(dname) database.init() parseBlacklist() if not DEBUG: myhttp.myLogger.verbose = False server = startServer() try: roll() except Exception as e: server.close() raise e
import sys # Import scripts from scripts.createVCloneRepository import createVCloneRepository from scripts.checkDependencyExistance import checkDependencyExistance from server import startServer # Config (Authentication method and/or password is available in scripts/authentication.py) env['PORT'] = '5555' env['MAIN'] = path.dirname(path.abspath(__file__)) env['SECRET1'] = 'password' env['SECRET2'] = 'CZEQmTxdS7XoXnWJds7IwooWZ6wtXRhnNr2Rg71VtZA=' # Verify that all modules are present print('Please wait... Verifying that all modules have been installed correctly...') checkDependencyExistance('bottle') # Make sure that a valid vclone-repository exists. Else, create one. (Not yet implemented) print('User repository location: ' + env['VCLONE_REPOSTORY']) if (not(path.isdir(env['VCLONE_REPOSTORY']) == True and path.isdir(env['VCLONE_REPOSTORY'] + '/backups') == True and path.isdir(env['VCLONE_REPOSTORY'] + '/files') == True and path.isfile(env['VCLONE_REPOSTORY'] + '/files.json') == True)): if (input('VClone repository does not exist on local machine and will now be created, enter "CONFIRM" to confirm this action.\n\nInput: ') != 'CONFIRM'): print('Aborting.') sys.exit(0) createVCloneRepository(env['VCLONE_REPOSTORY']) print('Created repository directory at the following path: {0}\n'.format(env['VCLONE_REPOSTORY'])) startServer()
import pir from camera import Camera import os import time import server import iot_temp_humidity.sensor as sensor def startMotionDetect(): cam = Camera() while True: motion = pir.isMotionDetected() if motion==1: #PIR signal is LOW print "No motion" elif motion==0: #PIR signal is HIGH print "Motion" cam.makePreview(5) #os.system('bash ./pushbullet.sh "hey, its me"') time.sleep(1) #startMotionDetect() sensor.getTempAndHumidityFromSensor() server.startServer()
def run(self): import server server.startServer()
elif mode[0] == 'server': port = addon.getSetting('server_port') action = args.get('action', None) action = action[0] dp = xbmcgui.DialogProgressBG() dp.create('DNA TV', 'Just A Second ...') if action == 'start': if server.serverOnline(): xbmcgui.Dialog().notification(addonname, 'Server already started.\nPort: ' + str(port), xbmcgui.NOTIFICATION_INFO) else: server.startServer() time.sleep(5) if server.serverOnline(): xbmcgui.Dialog().notification(addonname, 'Server started.\nPort: ' + str(port), xbmcgui.NOTIFICATION_INFO) else: xbmcgui.Dialog().notification(addonname, 'Server not started. Wait one moment and try again. ', xbmcgui.NOTIFICATION_ERROR) else: if server.serverOnline(): server.stopServer() time.sleep(5) xbmcgui.Dialog().notification(addonname, 'Server stopped.', xbmcgui.NOTIFICATION_INFO) else: xbmcgui.Dialog().notification(addonname, 'Server is already stopped.', xbmcgui.NOTIFICATION_INFO) dp.close()
def startServer(args): return server.startServer(args)
def main(): print("Server is starting..") server.startServer() print("Server OFF")
def main(): startServer()
elif mode[0] == 'server': port = addon.getSetting('server_port'); action = args.get('action', None); action = action[0]; dp = xbmcgui.DialogProgressBG(); dp.create('IPTV', 'Working ...'); if action == 'start': if server.serverOnline(): xbmcgui.Dialog().notification(addonname, 'Server already started.\nPort: ' + str(port), xbmcgui.NOTIFICATION_INFO ); else: server.startServer(); time.sleep(5); if server.serverOnline(): xbmcgui.Dialog().notification(addonname, 'Server started.\nPort: ' + str(port), xbmcgui.NOTIFICATION_INFO ); else: xbmcgui.Dialog().notification(addonname, 'Server not started. Wait one moment and try again. ', xbmcgui.NOTIFICATION_ERROR ); else: if server.serverOnline(): server.stopServer(); time.sleep(5); xbmcgui.Dialog().notification(addonname, 'Server stopped.', xbmcgui.NOTIFICATION_INFO ); else: xbmcgui.Dialog().notification(addonname, 'Server is already stopped.', xbmcgui.NOTIFICATION_INFO ); dp.close();
import sys from server import startServer args = sys.argv n = len(args) if (n > 1): port = int(args[1]) else: port = 80 import src.aluno.routing import src.curso.routing import src.disciplina.routing import src.matricula.routing import src.turma.routing import src.avaliacao.routing import src.frequencia.routing import src.nota.routing startServer(port)
# -*- coding: utf-8 -*- from server import startServer """ Currency converter main file. """ if __name__ == "__main__": startServer()
def startSocketServer(): server = SocketServer() server.startServer()
def main(): logwriter.writeServer("program started") database.start() server.startServer()
content={"message": "Id already exists in todo list"}) todoList.append(newTodo) return {"message": "Todo created!"} @app.patch("/todos/{todo_id}") def update_todo(todo_id: int, updateTodo: Todo): for todo in todoList: if (todo.id == todo_id): todo.what = updateTodo.what todo.completed = updateTodo.completed return {"todo": todo} return JSONResponse(status_code=404, content={"message": "Todo not found"}) @app.delete("/todos/{todo_id}") def delete_todo(todo_id: int): for todo in todoList: if (todo.id == todo_id): todoList.remove(todo) return {"message": "Todo deleted!"} return JSONResponse(status_code=404, content={"message": "Todo not found"}) # Start the server startServer(app)
elif mode[0] == 'server': port = addon.getSetting('server_port'); action = args.get('action', None); action = action[0]; dp = xbmcgui.DialogProgressBG(); dp.create('IPTV', 'Just A Second ...'); if action == 'start': if server.serverOnline(): xbmcgui.Dialog().notification(addonname, 'Server already started.\nPort: ' + str(port), xbmcgui.NOTIFICATION_INFO ); else: server.startServer(); time.sleep(5); if server.serverOnline(): xbmcgui.Dialog().notification(addonname, 'Server started.\nPort: ' + str(port), xbmcgui.NOTIFICATION_INFO ); else: xbmcgui.Dialog().notification(addonname, 'Server not started. Wait one moment and try again. ', xbmcgui.NOTIFICATION_ERROR ); else: if server.serverOnline(): server.stopServer(); time.sleep(5); xbmcgui.Dialog().notification(addonname, 'Server stopped.', xbmcgui.NOTIFICATION_INFO ); else: xbmcgui.Dialog().notification(addonname, 'Server is already stopped.', xbmcgui.NOTIFICATION_INFO ); dp.close();
# offerings = course["offerings"] # labels = course["topics"] # print("Loaded course `" + courseName + "` with " + # str(len(offerings)) + " offering(s)") # questions = [] # for offering in offerings: # print("Offering ID:", offering["id"]) # questions.extend(getQuestions(offering["id"])) # our_labels = labeler.loadLabels(COURSE1) # our_labels.update(labeler.loadLabels(COURSE2)) # Show an accuracy report comparing manual labels to automatic labels # printAccuracyReport("Ensemble", taggers["query"], questions, our_labels) email = input('Please enter your email: ') password = getpass.getpass() print("Logging in...") piazza = Piazza() piazza.user_login(email=email, password=password) print("Setting up...") fetcher = CourseFetcher(piazza, configuration) fetcher.runRobots() print("Starting HTTP server...") import server server.startServer(8080, fetcher)