通用的Python ActivityPub库
项目描述
安装
您可以使用以下命令安装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库。它针对三个不同级别的使用
ActivityPub对象API
ActivityPub数据库API
Web服务器API
这些级别可以单独使用,也可以一起使用。最好通过Manager一起使用它们
>>> from activitypub.manager import Manager
>>> from activitypub.database import ListDatabase
>>> 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(包括内存中的SQLite)
Firebird
Microsoft SQL Server
MySQL
Oracle
PostgreSQL
Sybase
…等等!
一个基于JSON的内存数据库,用于测试
Redis
activitypub数据库API是MongoDB的一个子集。
activitypub针对以下Web框架
Flask
Tornado
其他框架也可以支持。请提问!
activitypub Web服务API基于Flask的。
项目详情
下载文件
下载适用于您平台文件的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码分发
activitypub-0.0.3.tar.gz (32.0 kB 查看散列值)
构建分发
activitypub-0.0.3-py2.py3-none-any.whl (42.5 kB 查看散列值)
关闭
activitypub-0.0.3.tar.gz的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | 81f02761097fa9bacb8490a1a6f8cf61ae96bc100c74775046ea441082b69510 |
|
MD5 | 0ccd064b8c1a604f925868db5c0c53c6 |
|
BLAKE2b-256 | 8075b2efd7c9a71c190ad2b10c5b01e841787a6466dea9946fa3846cd839a819 |
关闭
activitypub-0.0.3-py2.py3-none-any.whl的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | 68efb25c0f8a64ccab8f86302d9fc2d001a8ce164501bddd2218e69b582adbf7 |
|
MD5 | 141bae3aba6ab9ee0f35e1a046af6910 |
|
BLAKE2b-256 | a842994effdea023d736eef62bd8a1ca02c26af3b8a945823fff06ddee309f90 |