googl.py 文件源码

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

项目:GrandeCogs 作者: HarukiGrande 项目源码 文件源码
def shorten(self, ctx, url):
        """Shorten url"""
        key = self.loadapi["ApiKey"]
        shorten = 'https://www.googleapis.com/urlshortener/v1/url?key=' + key
        payload = {"longUrl": url}
        headers = {'content-type': 'application/json'}
        async with aiohttp.ClientSession() as session:
            async with session.post(shorten,data=json.dumps(payload),headers=headers) as resp:
                print(resp.status)
                yes = await resp.json()
                await self.bot.say(yes['id'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号