__init__.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:SDV-Summary 作者: Sketchy502 项目源码 文件源码
def _op_imgur_post(url):
    db = get_db()
    cur = db.cursor()
    if logged_in():
        check_access = imgur.checkApiAccess(get_logged_in_user())
        if check_access == True:
            result = imgur.uploadToImgur(get_logged_in_user(),url)
            if 'success' in result:
                return redirect(result['link'])
            elif 'error' in result:
                if result['error'] == 'too_soon':
                    g.error = _('You have uploaded this page to imgur in the last 2 hours: please wait to upload again')
                elif result['error'] == 'upload_issue':
                    g.error = _('There was an issue with uploading the file to imgur. Please try again later!')
            else:
                g.error = 'There was an unknown error!'
            return render_template("error.html", **page_args())
        elif check_access == False:
            return redirect(imgur.getAuthUrl(get_logged_in_user(),target=request.path))
        elif check_access == None:
            g.error = _('Either you or upload.farm are out of imgur credits for the day! Sorry :( Try again tomorrow')
            return render_template("error.html", **page_args())
    else:
        g.error = _("You must be logged in to post your farm to imgur!")
        return render_template("signup.html", **page_args())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号