Exemple #1
0
from hashids import hashids;

hashids_lib = hashids("this is my salt")
hash = hashids_lib.encrypt(1, 2, 3)
numbers = hashids_lib.decrypt(hash)

print(hash)
print(numbers)
Exemple #2
0
    from logging.handlers import SMTPHandler
    mail_handler = SMTPHandler(keys.SMTP_SERVER, '*****@*****.**', ADMINS, 'Digestif has ERRORS', credentials=(keys.SMTP_USER, keys.SMTP_PASSWORD))
    mail_handler.setLevel(logging.ERROR)
    mail_handler.setFormatter(Formatter(mail_format))
    file_handler = TimedRotatingFileHandler("/home/jclarke/webapps/digestifweb/logs/digestifweb.log", when="W0", backupCount=10)
    file_handler.setLevel(logging.INFO)
    file_handler.setFormatter(Formatter("%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]"))
    app.logger.setLevel(logging.INFO)
    for logger in [app.logger, logging.getLogger("sqlalchemy"), logging.getLogger('flask_oauthlib')]:
        logger.addHandler(file_handler)
        logger.addHandler(mail_handler)

db = SQLAlchemy(app)


hash_gen = hashids(keys.HASH_GEN)


oauth = OAuth()
flickr_oauth = oauth.remote_app("flickr",
    base_url="https://api.flickr.com/services/rest",
    request_token_url="https://www.flickr.com/services/oauth/request_token",
    access_token_url="https://www.flickr.com/services/oauth/access_token",
    authorize_url="https://www.flickr.com/services/oauth/authenticate",
    consumer_key=keys.FLICKR,
    consumer_secret=keys.FLICKR_SECRET)

instagram_oauth = oauth.remote_app("instagram",
                                   base_url="https://api.instagram.com/v1/",
                                   request_token_url=None,
                                   access_token_url="https://api.instagram.com/oauth/access_token",
Exemple #3
0
from hashids import hashids

hashids_lib = hashids("this is my salt")
hash = hashids_lib.encrypt(1, 2, 3)
numbers = hashids_lib.decrypt(hash)

print(hash)
print(numbers)
Exemple #4
0
    file_handler.setFormatter(
        Formatter(
            "%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]"
        ))
    app.logger.setLevel(logging.INFO)
    for logger in [
            app.logger,
            logging.getLogger("sqlalchemy"),
            logging.getLogger('flask_oauthlib')
    ]:
        logger.addHandler(file_handler)
        logger.addHandler(mail_handler)

db = SQLAlchemy(app)

hash_gen = hashids(keys.HASH_GEN)

oauth = OAuth()
flickr_oauth = oauth.remote_app(
    "flickr",
    base_url="https://api.flickr.com/services/rest",
    request_token_url="https://www.flickr.com/services/oauth/request_token",
    access_token_url="https://www.flickr.com/services/oauth/access_token",
    authorize_url="https://www.flickr.com/services/oauth/authenticate",
    consumer_key=keys.FLICKR,
    consumer_secret=keys.FLICKR_SECRET)

instagram_oauth = oauth.remote_app(
    "instagram",
    base_url="https://api.instagram.com/v1/",
    request_token_url=None,