google.py 文件源码

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

项目:pyconjpbot 作者: pyconjp 项目源码 文件源码
def google_map(message, keywords):
    """
    google ?????????????

    https://github.com/llimllib/limbo/blob/master/limbo/plugins/map.py
    """
    query = quote(keywords)

    # Slack seems to ignore the size param
    #
    # To get google to auto-reasonably-zoom its map, you have to use a marker
    # instead of using a "center" parameter. I found that setting it to tiny
    # and grey makes it the least visible.
    url = "https://maps.googleapis.com/maps/api/staticmap?size=800x400&markers={0}&maptype={1}"
    url = url.format(query, 'roadmap')

    botsend(message, url)
    attachments = [{
        'pretext': '<http://maps.google.com/maps?q={}|????????>'.format(query),
        'mrkdwn_in': ["pretext"],
    }]
    botwebapi(message, attachments)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号