fetchers.py 文件源码

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

项目:telegram-autoposter 作者: vaniakosmos 项目源码 文件源码
def fetch(self):
        section = 'hot'  # hot | top | user
        sort = 'viral'  # viral | top | time | rising (only available with user section)
        show_viral = 'true'
        show_mature = 'true'
        album_previews = 'false'

        url = f'https://api.imgur.com/3/gallery/{section}/{sort}'
        querystring = {"showViral": f"{show_viral}", "mature": f"{show_mature}", "album_previews": f"{album_previews}"}
        headers = {'authorization': f'Client-ID {client_id}'}
        response = requests.request("GET", url, headers=headers, params=querystring)
        json = response.json()

        self.logger.debug(f'Fetched. Code: {response.status_code}')

        return json['data'][:FETCH_LIMIT]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号