request.py 文件源码

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

项目:TumblrVideos 作者: moedje 项目源码 文件源码
def get(self, url, params):
        """
        Issues a GET request against the API, properly formatting the params

        :param url: a string, the url you are requesting
        :param params: a dict, the key-value of all the paramaters needed
                       in the request
        :returns: a dict parsed of the JSON response
        """
        url = self.host + url
        if params:
            url = url + "?" + urllib.urlencode(params)

        client = oauth.Client(self.consumer, self.token, proxy_info=self.proxy_info)
        client.disable_ssl_certificate_validation = True
        try:
            client.follow_redirects = False
            resp, content = client.request(url, method="GET", redirections=False)
        except RedirectLimit, e:
            resp, content = e.args

        return self.json_parse(content)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号