activitypub/README.md

30 wiersze
986 B
Markdown
Czysty Zwykły widok Historia

2018-07-19 12:45:34 +00:00
# activitypub
2018-04-22 16:17:55 +00:00
2018-07-19 12:45:34 +00:00
This module is designed to be a generally useful ActivityPub library in Python. It targets three different levels of use:
2018-04-22 16:17:55 +00:00
2018-07-19 12:45:34 +00:00
* ActivityPub object API
* ActivityPub database API
* Webserver
The first two levels can be used indpendently, or together. They can best be used toegether using a Manager:
2018-07-19 12:46:27 +00:00
```python
2018-07-19 13:45:11 +00:00
>>> from activitypub import Manager
>>> from activitypub.database import DummyDatabase
2018-07-19 12:45:34 +00:00
>>> db = DummyDatabase()
>>> 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'}
2018-04-22 16:17:55 +00:00
```