分类: 开源软件 的文章有 3 篇

authlib - python OAuth/OpenID library

The ultimate Python library in building OAuth, OpenID Connect clients and servers. JWS,JWE,JWK,JWA,JWT included.

这个库可以用做oauth/openid的客户端,或者自建oauth/openid server端。
flask 和 django都有文档示例。

还有个flask 的oauth server 库, https://flask-oauthlib.readthedocs.io/en/latest/oauth2.html , 不过官方建议使用上述的authlib.

阅读全文 ~

python-feedgen: 一个生成atom, rss及podcasts源的python库

项目地址:https://github.com/lkiesow/python-feedgen
文档地址:https://lkiesow.github.io/python-feedgen/

示例:

from feedgen.feed import FeedGenerator


def feed():
    """
    Generate atom feed
    """
    entries = parse_posts(0, C.feed_count)
    fg = FeedGenerator()
    fg.id(str(len(entries)))
    fg.title(C.title)
    fg.subtitle(C.subtitle)
    fg.language(C.language)
    fg.author(dict(name=C.author, email=C.email))
    fg.link(href=C.root_url, rel='alternate')
    fg.link(href=make_abs_url(C.root_url, 'feed'), rel='self')
    for entry in entries:
        fe = fg.add_entry()
        fe.id(entry.get('url'))
        fe.title(entry.get('title'))
        fe.published(entry.get('date'))
        fe.updated(entry.get('updated') or entry.get('date'))
        fe.link(href=make_abs_url(C.root_url, entry.get('url')), rel='alternate')
        fe.author(dict(name=entry.get('author'), email=entry.get('email')))
        fe.content(entry.get('body'))

    atom_feed = fg.atom_str(pretty=True)
    return atom_feed
阅读全文 ~