googl.py 文件源码

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

项目:GrandeCogs 作者: HarukiGrande 项目源码 文件源码
def analytics(self, ctx, url):
        """Analytics for url"""
        key = self.loadapi["ApiKey"]
        async with aiohttp.ClientSession() as session:
            async with session.get('https://www.googleapis.com/urlshortener/v1/url?key=' + key + '&shortUrl=' + url + '&projection=FULL') as resp:
                print(resp.status)
                yes = await resp.json()
                embed = discord.Embed(colour=discord.Colour.blue())
                embed.add_field(name="**Shortened Url:**",value=yes['id'])
                embed.add_field(name="**Long Url:**",value=yes['longUrl'])
                embed.add_field(name="**Date Created:**",value=yes['created'])
                embed.add_field(name="**Clicks:**",value=yes['analytics']['allTime']['shortUrlClicks'])
                embed.set_image(url="https://www.ostraining.com/cdn/images/coding/google-url-shortener-tool.jpg")
                await self.bot.say(embed=embed)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号