Skip to main content

A general Python ActivityPub library

Project description

This is a Python library to use with
ActivityPub. ActivityPub
is an API for an open, distributed, social network.

Install

You can install the development version of activitypub with:

pip install git+git://github.com/dsblank/activitypub

or the last packaged version with:

pip install activitypub

Abstractions

This module is designed to be a generally useful ActivityPub library in Python. It targets three different levels of use:

  • ActivityPub object API

  • ActivityPub database API

  • Webserver API

These levels can be used independently, or together. They can best be used together using a 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 supports the following databases:

  • MongoDB

  • SQL dialects — any that that sqlalchemy supports, including:

  • SQLite (including in-memory)

  • Firebird

  • Microsoft SQL Server

  • MySQL

  • Oracle

  • PostgreSQL

  • Sybase

  • … and many more!

  • An in-memory, JSON-based database for testing

  • Redis

The activitypub database API is a subset of the MongDB.

activitypub is targeting the following web frameworks:

  • Flask

  • Tornado

Others can be supported. Please ask!

The activitypub webservice API is based on Flask’s.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

activitypub-0.0.2.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

activitypub-0.0.2-py2.py3-none-any.whl (34.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file activitypub-0.0.2.tar.gz.

File metadata

  • Download URL: activitypub-0.0.2.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for activitypub-0.0.2.tar.gz
Algorithm Hash digest
SHA256 530c7bb69528ae779d8b4df254d8d66d3868c3692530d620700c3ee0f9de754c
MD5 0f2051b95cc8d85ac93722f584471efa
BLAKE2b-256 086a8bd1ecdb7790e474ac01cdf8ccf94cebeec195978f7966f3db80245edd12

See more details on using hashes here.

File details

Details for the file activitypub-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for activitypub-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fa5a3011df1f9909ffc9dc46112b0077e6f9b4773545cb782d0f860c262c4fad
MD5 f08891afb5419f28e103ecc6da71d610
BLAKE2b-256 46aeed982f0e3f7b3b2ce9871e54efe8a76e46c9bd1106a2118f5156e220cbb6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page