通用python activitypub库

activitypub的Python项目详细描述


这是一个与
一起使用的python库
ActivityPub。 活动按钮
是一个用于开放、分布式社交网络的api。

安装

您可以使用以下命令安装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的。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java传递实现接口的内部类   java为什么managedbean方法在post请求中的过滤器调用之前调用   java Android应用程序在Android M,O上崩溃,登录A/libc时出错:tid 17938中的致命信号11(SIGSEGV),代码2,故障地址0x343a2944   java JPA存储库。findByAll()返回null,但数据库中存在所有内容   用于发送电子邮件的java Ant脚本   Java小程序HTML页面发生了奇怪的事情   在Postman的请求正文中传递多个JSON数据,并使用Jersy(JXRS)进入Java Rest API   无法强制转换java DAO类   10分钟后重新连接java   正则表达式如何在java中选择字符串直到某个字符   java我的输出有一些问题   Objective中的java时间段   java如何在新屏幕上基于按钮单击在webview中打开url   java哪个selenium版本与Firefox ESR 45.2.0兼容   java无法使用Apache Camel 3.1.0将XML转换为JSON