class Config(object): SECRET_KEY = os.environ.get('SECRET_KEY') or secrets.token_hex(128) DEBUG = bool(os.environ.get('DEBUG')) or False REDIS_NAME = os.environ.get('REDIS_NAME') or 'localhost' REDIS_URL = f'redis://{REDIS_NAME}' JWT_SECRET = os.environ.get( 'JWT_SECRET') or 'ChangeMeChangeMeChangeMeChangeMeChangeMeChangeMeChangeMeChangeMeChangeMe' JWT_SESSION_TIME = int(os.environ.get('JWT_SESSION_TIME') or '4') APP_URL = os.environ.get('APP_URL') or 'http://localhost:5000' FILE_STORE_HOST = os.environ.get('FILE_STORE_HOST') or 'localhost' FILE_STORE_URL = f'http://{FILE_STORE_HOST}:8081' PUBLICATION_API_HOST = os.environ.get( 'PUTLICATION_API_HOST') or 'localhost' PUBLICATION_API_URL = f'http://{PUBLICATION_API_HOST}:8090' redis = redis.Redis(REDIS_NAME) # user_manager = UserManager(redis) login_manager = LoginManager(redis) AUTH0_CLIENT_ID = os.environ.get('AUTH0_CLIENT_ID') AUTH0_CLIENT_SECRET = os.environ.get('AUTH0_CLIENT_SECRET') AUTH0_API_BASE_URL = os.environ.get('AUTH0_API_BASE_URL') AUTH0_CALLBACK_URL = APP_URL + '/callback'
def test_login(): """test""" login = LoginManager() assert isinstance(login.token, str) assert isinstance(login.username, str) assert isinstance(login.password, str)
def __init__(self, access_id: str, password: str, security_questions: tuple) -> None: self.password = password self.access_id = access_id self.security_questions = security_questions self.login_manager = LoginManager(requests.Session(), self.access_id, self.password, self.security_questions)
wikilines.append("\n[[Category:word2mediawiki]]\n") # Grab images out of the XML data parser = XMLParser(target=ImageGrabber()) # XXX: rewrite the namespace so as not to confuse certain XML parsers # (changes either in newer open/libreoffice or newer XML parsers require this) parser.feed(open('%s/converted.xml' % tempdir).read().replace("\"http://www.w3.org/XML/1998/namespace\"","\"http://www.w3.org/XML/1998/namespace_bugfix\"")) parser.close() # Prepare for uploading to mediawiki # Make sure we are logged in with IOWrapper("Logging in..."): site = wikipedia.getSite(language, family) if not site.loggedInAs(): lm = LoginManager(site=site, password=password) if lm.login(retry=True): site._isLoggedIn[0] = True site._userName[0] = lm.username site._userData[0] = False # Make sure all the filenames we want to use are empty, and if not, twiddle # the filename until they are. outnamecounter = 0 while True: if outnamecounter > 0: outname = "%s_%s" % (baseoutname, outnamecounter) else: outname = baseoutname outnamecounter += 1 if outnamecounter > 50: