def sign_up(request): if 'signup.submit' in request.params: username = request.params['mail'] passwd = request.params['passwd'] passwd1 = request.params['passwd1'] if passwd != passwd1: raise HTTPNotFound map_fun = Account.by_mail.map_fun db = request.db result = db.query(map_fun, key=username) if len(result): raise HTTPNotFound account = Account(username, passwd) db = request.db account.store(db) headers = remember(request, username) return HTTPFound(location = '/', headers = headers) return dict(post_url = request.path)
def _factory(self, module, config): if (module == 'cdb'): from modules.cdb import Cdb service = Cdb(config) elif (module == 'account'): from modules.account import Account service = Account(config) elif (module == 'cvm'): from modules.cvm import Cvm service = Cvm(config) elif (module == 'image'): from modules.image import Image service = Image(config) elif (module == 'lb'): from modules.lb import Lb service = Lb(config) elif (module == 'sec'): from modules.sec import Sec service = Sec(config) elif (module == 'trade'): from modules.trade import Trade service = Trade(config) elif (module == 'bill'): from modules.bill import Bill service = Bill(config) elif (module == 'monitor'): from modules.monitor import Monitor service = Monitor(config) elif (module == 'cdn'): from modules.cdn import Cdn service = Cdn(config) elif (module == 'vpc'): from modules.vpc import Vpc service = Vpc(config) elif (module == 'vod'): from modules.vod import Vod service = Vod(config) elif (module == 'yunsou'): from modules.yunsou import Yunsou service = Yunsou(config) elif (module == 'wenzhi'): from modules.wenzhi import Wenzhi service = Wenzhi(config) elif (module == 'market'): from modules.market import Market service = Market(config) elif (module == 'live'): from modules.live import Live service = Live(config) elif (module == 'eip'): from modules.eip import Eip service = Eip(config) else: raise ValueError, 'module not exists' return service
def _factory(self, module, config): if (module == 'cdb'): from modules.cdb import Cdb service = Cdb(config) elif (module == 'account'): from modules.account import Account service = Account(config) elif (module == 'cvm'): from modules.cvm import Cvm service = Cvm(config) elif (module == 'image'): from modules.image import Image service = Image(config) elif (module == 'lb'): from modules.lb import Lb service = Lb(config) elif (module == 'sec'): from modules.sec import Sec service = Sec(config) elif (module == 'trade'): from modules.trade import Trade service = Trade(config) elif (module == 'bill'): from modules.bill import Bill service = Bill(config) elif (module == 'monitor'): from modules.monitor import Monitor service = Monitor(config) elif (module == 'cdn'): from modules.cdn import Cdn service = Cdn(config) elif (module == 'vpc'): from modules.vpc import Vpc service = Vpc(config) elif (module == 'vod'): from modules.vod import Vod service = Vod(config) elif (module == 'yunsou'): from modules.yunsou import Yunsou service = Yunsou(config) elif (module == 'wenzhi'): from modules.wenzhi import Wenzhi service = Wenzhi(config) elif (module == 'market'): from modules.market import Market service = Market(config) elif (module == 'live'): from modules.live import Live service = Live(config) elif (module == 'eip'): from modules.eip import Eip service = Eip(config) elif (module == 'cbs'): from modules.cbs import Cbs service = Cbs(config) elif (module == 'snapshot'): from modules.snapshot import Snapshot service = Snapshot(config) elif (module == 'scaling'): from modules.scaling import Scaling service = Scaling(config) elif (module == 'cmem'): from modules.cmem import Cmem service = Cmem(config) elif (module == 'tdsql'): from modules.tdsql import Tdsql service = Tdsql(config) elif (module == 'bm'): from modules.bm import Bm service = Bm(config) elif (module == 'redis'): from modules.redis import Redis service = Redis(config) elif (module == 'dfw'): from modules.dfw import Dfw service = Dfw(config) else: raise ValueError, 'module not exists' return service
log = Logger("M").log read = Open().read logo() git = Github() git.printCommit(amount=1) log("Loading oneCaptcha settings...\n", 'note') accounts = read('config/accounts.json') for account in accounts: questions = [ inquirer.List('selection', message=f"Action choice for {str(account['account']).split(':')[0]}", choices=['Start oneCaptcha Engine', 'Regular Browsing Session', 'Update Cookie Session'], ), ] answers = inquirer.prompt(questions) acc = Account(account) if answers['selection'] == 'Start oneCaptcha Engine': Thread(target=acc.startProcess, daemon=True).start() elif answers['selection'] == "Regular Browsing Session": Thread(target=acc.createOpenSession, daemon=True).start() elif answers['selection'] == "Update Cookie Session": Thread(target=acc.createOpenSession, kwargs={'save': True}, daemon=True).start() else: Thread(target=acc.startProcess, daemon=True).start() while True: time.sleep(1000)
def _factory(self, module, config): if (module == 'cdb'): from modules.cdb import Cdb service = Cdb(config) elif (module == 'account'): from modules.account import Account service = Account(config) elif (module == 'cvm'): from modules.cvm import Cvm service = Cvm(config) elif (module == 'image'): from modules.image import Image service = Image(config) elif (module == 'lb'): from modules.lb import Lb service = Lb(config) elif (module == 'sec'): from modules.sec import Sec service = Sec(config) elif (module == 'trade'): from modules.trade import Trade service = Trade(config) elif (module == 'bill'): from modules.bill import Bill service = Bill(config) elif (module == 'monitor'): from modules.monitor import Monitor service = Monitor(config) elif (module == 'cdn'): from modules.cdn import Cdn service = Cdn(config) elif (module == 'vpc'): from modules.vpc import Vpc service = Vpc(config) elif (module == 'vod'): from modules.vod import Vod service = Vod(config) elif (module == 'yunsou'): from modules.yunsou import Yunsou service = Yunsou(config) elif (module == 'wenzhi'): from modules.wenzhi import Wenzhi service = Wenzhi(config) elif (module == 'market'): from modules.market import Market service = Market(config) elif (module == 'live'): from modules.live import Live service = Live(config) elif (module == 'eip'): from modules.eip import Eip service = Eip(config) elif (module == 'cbs'): from modules.cbs import Cbs service = Cbs(config) elif (module == 'snapshot'): from modules.snapshot import Snapshot service = Snapshot(config) elif (module == 'scaling'): from modules.scaling import Scaling service = Scaling(config) elif (module == 'iotcloud'): from modules.iotcloud import IOTCLOUD service = IOTCLOUD(config) return service
import os import locale import sys from modules.account import Account all_actions = [cls for cls in Account.__subclasses__()] class Teller(): """This class is the interface to a customer's bank account""" def build_menu(self): """Construct the main menu items for the command line user interface""" # Clear the console first os.system('cls' if os.name == 'nt' else 'clear') print('Enter a number to perform a transaction: ') for action in all_actions: print(f'{all_actions.index(action) + 1}. {action().prompt}') def start_service(self): self.build_menu() choice = int(input(">> ")) if choice > len(all_actions) or choice < 1: self.start_service() action = all_actions[choice - 1] action.transact() another = input('Perform another transaction? (Y/any): ')
def accounts(): if arguments['link']: plex_username = arguments['<PlexUsername>'] if databases.verify_plex_user_existance(plex_username): text = "Linking Plex user %s to Trakt.tv profile.." % plex_username spinner = yaspin(text=text, color="green") spinner.start() spinner.ok("✔") spinner.stop() utils.link_user(plex_username) else: databases.close_connections() exit(0) if arguments['unlink']: plex_username = arguments['<PlexUsername>'] if databases.verify_plex_user_existance(plex_username): text = "Unlinking Plex user %s from Trakt.tv profile.." % plex_username spinner = yaspin(text=text, color="green") spinner.start() spinner.ok("✔") spinner.stop() utils.unlink_user(plex_username) else: databases.close_connections() exit(0) if arguments['list']: if arguments['plex']: spinner = yaspin(text="Getting all current Plex users..", color="green") spinner.start() spinner.ok("✔") spinner.stop() utils.list_plex_users() else: spinner = yaspin(text="Getting all current Traktastic users..", color="green") spinner.start() spinner.ok("✔") spinner.stop() utils.list_traktastic_users() if arguments['<PlexUsername>']: plex_username = arguments['<PlexUsername>'] if databases.verify_tractastic_user_existance(plex_username): account = Account(databases, plex_username) if arguments['active']: spinner = yaspin(text="Setting account active..", color="green") spinner.start() account.set_active() spinner.text = "Account activated." spinner.ok("✔") if arguments['inactive']: spinner = yaspin(text="Setting account inactive..", color="green") spinner.start() account.set_inactive() spinner.text = "Account deactivated." spinner.ok("✔")
def downloads(): if arguments['<PlexUsername>']: plex_username = arguments['<PlexUsername>'] if databases.verify_tractastic_user_existance(plex_username): account = Account(databases, plex_username) if arguments['movies']: spinner = yaspin(text="Searching missing movie recommendations in Radarr..", color="green") spinner.start() if arguments['--hidden']: hidden = True else: hidden = False spinner = account.add_missing_movies_to_radarr(spinner, hidden) spinner.ok("✔") spinner.stop() if arguments['tv']: spinner = yaspin(text="Searching missing tv-shows recommendations in Sonarr..", color="green") spinner.start() if arguments['--hidden']: hidden = True else: hidden = False spinner = account.add_missing_tv_shows_to_radarr(spinner, hidden) spinner.ok("✔") spinner.stop() if arguments['all']: users = databases.get_traktastic_active_users() if len(users) == 0: print(colored(' > No active users found', 'yellow')) exit(0) if arguments['--hidden']: hidden = True else: hidden = False for user in users: account = Account(databases, user[1]) text = 'Searching missing movie recommendations of user %s in Radarr..' % user[1] spinner = yaspin(text=text, color="green") spinner.start() spinner = account.add_missing_tv_shows_to_radarr(spinner, hidden) spinner.text = spinner.text + ' (' + user[1] + ')' spinner.ok("✔") spinner.stop() text = 'Searching missing tv-show recommendations of user %s in Sonarr..' % user[1] spinner = yaspin(text=text, color="green") spinner.start() spinner = account.add_missing_movies_to_radarr(spinner, hidden) spinner.text = spinner.text + ' (' + user[1] + ')' spinner.ok("✔") spinner.stop()
def library(): if arguments['<PlexUsername>']: plex_username = arguments['<PlexUsername>'] if databases.verify_tractastic_user_existance(plex_username): account = Account(databases, plex_username) if arguments['tv']: spinner = yaspin(text="Creating tv-show recommendations library.. ", color="green") spinner.start() success = account.create_user_tv_recommendations_library() if success: spinner.ok("✔") else: spinner.text = "No tv-shows for this user are cached. Please run 'traktastic.py recommendations " + plex_username + " tv' first!" spinner.fail("💥 ") if arguments['movies']: spinner = yaspin(text="Creating movie recommendations library.. ", color="green") spinner.start() success = account.create_user_movie_recommendations_library() if success: spinner.ok("✔") else: spinner.text = "No movies for this user are cached. Please run 'traktastic.py recommendations " + plex_username + " movies' first!" spinner.fail("💥 ") if arguments['delete']: text = "Deleting recommendation libraries for user %s.." % plex_username spinner = yaspin(text=text, color="green") spinner.start() account.delete_user_recommendation_libraries() spinner.ok("✔") spinner.stop() if arguments['all']: users = databases.get_traktastic_active_users() if len(users) == 0: print(colored(' > No active users found', 'yellow')) exit(0) for user in users: account = Account(databases, user[1]) start_text = "(Re-)Creating recommendation libraries for user %s.." % user[1] spinner = yaspin(text=start_text, color="green") spinner.start() account.create_user_tv_recommendations_library() account.create_user_movie_recommendations_library() spinner.text = "(Re-)Creating of libraries successful for user %s" % user[1] spinner.ok("✔") spinner.stop()
def recommendation(): if arguments['<PlexUsername>']: plex_username = arguments['<PlexUsername>'] if databases.verify_tractastic_user_existance(plex_username): account = Account(databases, plex_username) if arguments['tv']: start_text = "Getting tv-show recommendations for user %s.." % plex_username spinner = yaspin(text=start_text, color="green") spinner.start() shows = account.get_tv_recommendations() spinner.ok("✔") spinner.stop() utils.list_tv_recommendations(shows) if arguments['movies']: start_text = "Getting movie recommendations for user %s.." % plex_username spinner = yaspin(text=start_text, color="green") spinner.start() movies = account.get_movie_recommendations() spinner.ok("✔") spinner.stop() utils.list_movies_recommendations(movies) if arguments['reset']: start_text = "Resetting recommendations for user %s.." % plex_username spinner = yaspin(text=start_text, color="green") spinner.start() account.delete_hidden_recommendations() spinner.text = "Reset successful for user %s" % plex_username spinner.ok("✔") spinner.stop() else: databases.close_connections() exit(0) if arguments['all']: users = databases.get_traktastic_active_users() if len(users) == 0: print(colored(' > No active users found', 'yellow')) exit(0) if arguments['reset']: for user in users: account = Account(databases, user[1]) start_text = "Resetting recommendations for user %s.." % user[1] spinner = yaspin(text=start_text, color="green") spinner.start() account.delete_hidden_recommendations() spinner.text = "Reset successful for user %s" % user[1] spinner.ok("✔") spinner.stop() else: for user in users: account = Account(databases, user[1]) start_text = "Updating recommendations for user %s.." % user[1] spinner = yaspin(text=start_text, color="green") spinner.start() account.get_tv_recommendations() account.get_movie_recommendations() spinner.text = "Update successful for user %s" % user[1] spinner.ok("✔") spinner.stop()
def update(): if arguments['<PlexUsername>']: plex_username = arguments['<PlexUsername>'] if databases.verify_tractastic_user_existance(plex_username): account = Account(databases, plex_username) if arguments['tv']: start_text = "Updating Plex user %s watched tv-shows to Trakt.tv.." % plex_username spinner = yaspin(text=start_text, color="green") spinner.start() account.update_watched_tv_shows() spinner.text = "Plex user %s watched tv-shows successfully updated to Trakt.tv!" % plex_username spinner.ok("✔") spinner.stop() if arguments['movies']: start_text = "Updating Plex user %s watched movies to Trakt.tv.." % plex_username spinner = yaspin(text=start_text, color="green") spinner.start() account.update_watched_movies() spinner.text = "Plex user %s watched movies successfully updated to Trakt.tv!" % plex_username spinner.ok("✔") spinner.stop() else: databases.close_connections() exit(0) if arguments['all']: users = databases.get_traktastic_active_users() if len(users) == 0: print(colored(' > No active users found', 'yellow')) exit(0) for user in users: account = Account(databases, user[1]) start_text = "Updating Plex user %s watched elements to Trakt.tv.." % user[1] spinner = yaspin(text=start_text, color="green") spinner.start() account.update_watched_tv_shows() account.update_watched_movies() spinner.text = "Plex user %s watched elements successfully updated to Trakt.tv!" % user[1] spinner.ok("✔") spinner.stop()