CommandLine.py 文件源码

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

项目:AutoUploaderGoogleDrive 作者: siorai 项目源码 文件源码
def shortenUrl(self, URL):
        """
        URL Shortener function that when combined with the uploading
        script adds a new key:value to the JSON response with a much
        more managable URL.

        Args:
            URL: string. URL parsed from JSON response
        """
        http = Authorize()
        service = discovery.build('urlshortener', 'v1', http=http)
        url = service.url()
        body =  {
            'longUrl': URL
                }
        response = url.insert(body=body).execute()
        logging.debug("URLSHRINK: %s" % response)
        short_url = response['id']
        logging.debug("URLSHRINK: %s" % short_url)
        return short_url
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号