Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def search(limit=30, offset=0):
if not app.config['MYSQL_ENABLED']:
return []
return (EmojiLog.query
.filter(EmojiLog.public_fg == True)
.order_by(EmojiLog.generated_at.desc())
.offset(offset)
.limit(limit)
.all())
def make_cache():
timeout = app.config['CACHE_TIMEOUT']
if app.config['MEMCACHED_ENABLED']:
hosts = app.config['MEMCACHED_HOSTS']
return BinarySupportedMemcachedCache(hosts, default_timeout=timeout)
return SimpleCache(default_timeout=timeout)
'text': text,
'font': font,
'color': color,
'back_color': back_color,
'size_fixed':size_fixed,
'align':align,
'stretch':stretch
}
attachment = {
'title': 'download emoji',
'text': str(params),
'image_url': 'http://emoji.pine.moe/emoji?' + urllib.parse.urlencode(params),
'color': '#' + bar_color
}
slack = slackweb.Slack(url=app.config['SLACK_WEBHOOK_URL'])
slack.notify(attachments=[attachment])
def slack_notify(text, font, color, back_color, size_fixed, align, stretch):
if not app.config['SLACK_ENABLED']:
return
bar_color = color[:6]
params = {
'text': text,
'font': font,
'color': color,
'back_color': back_color,
'size_fixed':size_fixed,
'align':align,
'stretch':stretch
}
attachment = {
'title': 'download emoji',
'text': str(params),
'image_url': 'http://emoji.pine.moe/emoji?' + urllib.parse.urlencode(params),
def make_cache():
timeout = app.config['CACHE_TIMEOUT']
if app.config['MEMCACHED_ENABLED']:
hosts = app.config['MEMCACHED_HOSTS']
return BinarySupportedMemcachedCache(hosts, default_timeout=timeout)
return SimpleCache(default_timeout=timeout)