helper.py 文件源码

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

项目:twtxt 作者: buckket 项目源码 文件源码
def generate_user_agent():
    try:
        version = pkg_resources.require("twtxt")[0].version
    except pkg_resources.DistributionNotFound:
        version = "unknown"

    conf = click.get_current_context().obj["conf"]
    if conf.disclose_identity and conf.nick and conf.twturl:
        user_agent = "twtxt/{version} (+{url}; @{nick})".format(
            version=version, url=conf.twturl, nick=conf.nick)
    else:
        user_agent = "twtxt/{version}".format(version=version)

    return {"User-Agent": user_agent}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号