通用python activitypub库
activitypub的Python项目详细描述
安装
您可以使用以下命令安装ActivityPub的开发版本:
pip install git+git://github.com/dsblank/activitypub
或最后一个打包版本:
pip install activitypub
与redis一起使用:
pip install redis redis_collections
或与MongoDB一起使用:
pip install pymongo
或与sqlalchemy一起使用:
pip install sqlalchemy
摘要
此模块设计为在 Python。它针对三种不同的使用级别:
- ActivityPub对象API
- ActivityPub数据库API
- Web服务器API
这些级别可以单独使用,也可以一起使用。他们最好是 使用管理器一起使用:
>>>fromactivitypub.managerimportManager>>>fromactivitypub.databaseimportListDatabase>>>db=ListDatabase()>>>manager=Manager(database=db)>>>p=manager.Person(id="alyssa")>>>p.to_dict(){'@context':'https://www.w3.org/ns/activitystreams','endpoints':{},'followers':'https://example.com/alyssa/followers','following':'https://example.com/alyssa/following','id':'https://example.com/alyssa','inbox':'https://example.com/alyssa/inbox','liked':'https://example.com/alyssa/liked','likes':'https://example.com/alyssa/likes','outbox':'https://example.com/alyssa/outbox','type':'Person','url':'https://example.com/alyssa'}>>>db.actors.insert_one(p.to_dict())>>>db.actors.find_one({"id":'https://example.com/alyssa'}){'@context':'https://www.w3.org/ns/activitystreams','endpoints':{},'followers':'https://example.com/alyssa/followers','following':'https://example.com/alyssa/following','id':'https://example.com/alyssa','inbox':'https://example.com/alyssa/inbox','liked':'https://example.com/alyssa/liked','likes':'https://example.com/alyssa/likes','outbox':'https://example.com/alyssa/outbox','type':'Person','url':'https://example.com/alyssa','_id':ObjectId('5b579aee1342a3230c18fbf7')}
ActivityPub支持以下数据库:
- MongoDB
- sql方言-sqlalchemy支持的任何语言,包括:
- sqlite(包括内存)
- 火鸟
- Microsoft SQL Server
- mysql
- 甲骨文
- PostgreSQL
- Sybase
- …还有更多!
- 用于测试的基于json的内存数据库
- redis
activitypub数据库api是mongodb的一个子集。
ActivityPub的目标是以下Web框架:
- 烧瓶
- 龙卷风
其他的可以支持。请问!
ActivityPub WebService API基于Flask的。