def run(): app = foundation.CementApp('depoch', base_controller=BaseController) try: app.setup() app.run() finally: app.close()
def run(): app = foundation.CementApp(label='pulldb', base_controller=BaseController) interfaces.load() oauth.load() try: app.setup() app.run() finally: app.close
def run(): monitor = foundation.CementApp(label='hubmon', base_controller=BaseController) fetcher.load() try: monitor.setup() monitor.run() finally: monitor.close()
def run(self): try: app = foundation.CementApp('EmBat') handler.register(baseController.baseController) app.setup() app.run() except Exception as e: print("[-] Error: %s\nExiting" % str(e)) finally: app.close()
def main(): # create the app app = foundation.CementApp('myapp') try: # register controllers handler.register(MyAppBaseController) handler.register(Controller1) handler.register(Controller2) # setup the app app.setup() # run it app.run() finally: # close it app.close()
def main(): try: # create the application app = foundation.CementApp('myapp') # register controllers handler.register(MyAppBaseController) handler.register(SecondController) handler.register(ThirdController) handler.register(FourthController) # setup the application app.setup() # run the application app.run() finally: # close the application app.close()
def main(): try: # create the application app = foundation.CementApp('myapp') # register non-base controllers handler.register(MyAppBaseController) handler.register(UsersController) handler.register(HostsController) handler.register(UsersListController) handler.register(HostsListController) # setup the application app.setup() # run it app.run() finally: # close it app.close()
def get_app(self): """App init, necessary to get to the logging service""" app = foundation.CementApp('myapp') app.setup() app.run() return app
# limitations under the License. """ Created September 4, 2012 @author: Justin Hammond, Rackspace Hosting """ from cement.core import backend, foundation import aiclib INVALID_VALUE = "N/A" defaults = backend.defaults('queries') defaults['queries']['debug'] = False app = foundation.CementApp('queries', config_defaults=defaults) def invalid_switch_ports(json=False, username="******", password="******", uri="https://nvp"): nvp = aiclib.nvp.Connection(uri, username=username, password=password) query = nvp.lswitch_port('*').query().length(1000) results = query.relations(['LogicalQueueConfig', 'LogicalSwitchConfig']).results() output = {} if json else "" msg = "Port:\t%s\nType:\t%s\nQRate:\t%s\nIP:\t%s\nMAC:\t%s\n\n" while results: if len(results['results']) == 0: break for lport in results['results']: logicalconfig = lport['_relations']['LogicalSwitchConfig']
def test_bad_label_chars(self): try: app = foundation.CementApp('some!bogus()label') except exc.FrameworkError as e: self.ok(e.msg.find('alpha-numeric')) raise
def test_bad_label(self): try: app = foundation.CementApp(None) except exc.FrameworkError as e: # FIX ME: verify error msg raise
import os import glob from cement.core import backend, foundation, handler from cli import JSONConfigParserHandler from cli import controllers CONFIG_DIR = os.path.join(__path__[0], './config') CONFIG_FILES = glob.glob(os.path.join(CONFIG_DIR, '*.json')) # defined app first and handlers afterwards app = foundation.CementApp('credovi', config_defaults=backend.defaults('credovi'), config_handler='JSONConfigParser', config_files=CONFIG_FILES) # hooks must be registered afterwards from cli.hooks import * handler.register(JSONConfigParserHandler) handler.register(controllers.BaseController) handler.register(controllers.DatabaseController) handler.register(controllers.CredoController) handler.register(controllers.CredoStandAloneController) handler.register(controllers.MMCIFController) handler.register(controllers.LigandController) handler.register(controllers.ModuleController) # setup the application app.setup()
from cement.core import foundation import validators import ra_resale_checker_utils as ra_check import time app = foundation.CementApp('ra_resale_checker') app.setup() app.args.add_argument('-u', action='store', dest='url', help='URL for checking') app.run() def url_method(url_for_input): global url url = url_for_input def validate_url(url_for_val): return validators.url(url_for_val) url = app.pargs.url if validate_url(url): response = ra_check.get_ra_page(url) is_ticket = True while is_ticket: if ra_check.check_ra_page(response): print('***** RA TICKET FOR SALE *****') is_ticket = False
"?response_type=token&client_id={0}&redirect_uri=" "{1}&scope=user_read+user_subscriptions").format( CLIENT_ID, REDIRECT_URL) print "Attempting to open a browser to let you authenticate with Twitch" try: if not webbrowser.open_new_tab(url): raise webbrowser.Error except webbrowser.Error: print "Unable to open a web browser, try accessing this URL manually instead:\n{0}".format( url) sys.exit(1) app = foundation.CementApp('twitch_downloader') try: app.setup() app.args.add_argument('-u', '--url', action='store', help='broadcast or highlight url') app.args.add_argument('-o', '--output', action='store', help='output folder for downloaded files', default='.') app.args.add_argument('-q', '--quality', action='store',
from cement.core import backend, foundation, hook, handler from cement.utils.misc import init_defaults from lib import baseController, parser import sys try: app = foundation.CementApp('autodb') handler.register(baseController.baseController) handler.register(parser.parser) app.setup() #add args #app.args.add_argument('-v', '--version', action='store_true', dest='printversion', help='Application Version') app.run() finally: app.close()