uploader.py 文件源码

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

项目:bpaste 作者: cbramy 项目源码 文件源码
def submit(self, code=None):
        if not code: raise NoCodeError()

        # post the form to bpaste.net
        body = urlencode(dict(code=code, lexer=self.lexer, expiry=self.expiry))

        try:
            response, content = self.http.request(self.url, 'POST', body=body, headers=self.headers)
        except ServerNotFoundError:
            raise CodeUploadError(-1, None)

        # check the response
        if response.status == 302 and response['location']:
            return response['location']

        raise CodeUploadError(response.status, content)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号