@@ -2,12 +2,13 @@ granary
22-------
33
44Granary is a library and REST API that fetches and converts between a
5- wide variety of data sources and formats:
5+ wide variety of social data sources and formats:
66
77- Facebook, Flickr, GitHub, Instagram, Mastodon, and Twitter native
88 APIs
99- Instagram and Facebook scraped HTML
10- - `ActivityStreams <http://activitystrea.ms/ >`__ 1.0 and 2.0 (JSON)
10+ - `ActivityStreams <http://activitystrea.ms/ >`__ 1.0 and 2.0 JSON,
11+ including `ActivityPub <https://activitypub.rocks/ >`__
1112- HTML and JSON with
1213 `microformats2 <http://microformats.org/wiki/microformats2 >`__
1314- `Atom <https://tools.ietf.org/html/rfc4287 >`__, `RSS
@@ -161,8 +162,8 @@ request.
161162Include the ``shares=false `` query parameter to omit shares, eg Twitter
162163retweets, from the results.
163164
164- To use the REST API in an existing ActivityStreams client, you’ll need
165- to hard-code exceptions for the domains you want to use
165+ To use the REST API in an existing ActivityStreams/ActivityPub client,
166+ you’ll need to hard-code exceptions for the domains you want to use
166167e.g. ``facebook.com``, and redirect HTTP requests to the corresponding
167168`endpoint above <#about >`__.
168169
@@ -180,9 +181,8 @@ passing the HTTP handler object. The handler should have a ``request``
180181attribute for the current HTTP request.
181182
182183The useful methods are ``get_activities() `` and ``get_actor() ``, which
183- returns the current authenticated user (if any). See the `individual
184- method
185- docstrings <https://github.com/snarfed/granary/blob/master/source.py> `__
184+ returns the current authenticated user (if any). See the `full reference
185+ docs <https://granary.readthedocs.io/en/stable/source/granary.html#module-granary.source> `__
186186for details. All return values are Python dicts of decoded
187187ActivityStreams 1 JSON.
188188
@@ -194,21 +194,7 @@ Troubleshooting/FAQ
194194
195195Check out the `oauth-dropins Troubleshooting/FAQ
196196section <https://github.com/snarfed/oauth-dropins#troubleshootingfaq> `__.
197- It’s pretty comprehensive and applies to this project too. For
198- searchability, here are a handful of error messages that `have solutions
199- there <https://github.com/snarfed/oauth-dropins#troubleshootingfaq> `__:
200-
201- ::
202-
203- bash: ./bin/easy_install: ...bad interpreter: No such file or directory
204-
205- ImportError: cannot import name certs
206-
207- ImportError: cannot import name tweepy
208-
209- File ".../site-packages/tweepy/auth.py", line 68, in _get_request_token
210- raise TweepError(e)
211- TweepError: must be _socket.socket, not socket
197+ It’s pretty comprehensive and applies to this project too.
212198
213199Future work
214200-----------
@@ -290,10 +276,6 @@ reconfigure it to see system packages with
290276``virtualenv --system-site-packages local ``.) Then, run
291277`docs/build.sh <https://github.com/snarfed/granary/blob/master/docs/build.sh >`__.
292278
293- `This ActivityStreams
294- validator <http://activitystreamstester.appspot.com/> `__ is useful for
295- manual testing.
296-
297279Release instructions
298280--------------------
299281
@@ -464,32 +446,81 @@ Facebook and Twitter’s raw HTML.
464446Changelog
465447---------
466448
467- 6.1 - unreleased
449+ 6.0 - 2023-03-22
468450~~~~~~~~~~~~~~~~
469451
452+ *Breaking changes: *
453+
454+ - ``as2 ``:
455+
456+ - Interpret bare string ``object ``, ``inReplyTo ``, etc values as
457+ ids, convert them to bare strings or ``id `` instead of ``url ``.
458+
459+ - ``microformats2 ``:
460+
461+ - Convert simple string ``in-reply-to ``, ``repost-of ``, ``like-of ``
462+ etc values to AS1 bare strings or ``id ``\ s instead of ``url ``\ s.
463+
470464*Non-breaking changes: *
471465
472466- Add new ``bluesky `` module for
473467 `Bluesky <https://blueskyweb.org/ >`__/`AT
474- Protocol <https://atproto.com/> `__.
468+ Protocol <https://atproto.com/> `__!
475469- ``as1 ``:
476470
477- - Add the ``organization `` object type.
471+ - Add the ``organization `` object type and ``ACTOR_TYPES `` constant
472+ (`based on
473+ AS2 <https://www.w3.org/TR/activitystreams-core/#actors> `__).
474+ - Add new ``get_ids ``, ``get_object ``, and ``get_objects ``
475+ functions.
478476
477+ - ``activity_changed ``: ignore ``inReplyTo.author ``
478+ (`snarfed/bridgy#1338 <https://github.com/snarfed/bridgy/issues/1338 >`__)
479479- ``as2 ``:
480480
481481 - Support converting between AS1 ``stop-following `` and AS2 ``Undo ``
482482 ``Follow ``.
483- - Add the ``Organization `` object type.
483+ - Support AS2 ``Accept `` and ``Reject `` for follows as well as event
484+ RSVPs.
485+ - Add support for the ``Question `` (ie poll), ``Organization ``, and
486+ ``Delete `` object types.
487+ - Convert ``to ``/``cc `` to/from AS1 ``to `` for public and unlisted.
488+ - Handle ``type: Document `` video attachments like Mastodon emits.
484489 - ``from_as1 ``: bug fix for image objects with ``url `` and ``value ``
485490 fields (for alt text).
491+ - ``from_as1 ``: bug fix, handle bare string URL ``image `` values.
486492 - ``from_as1 ``: convert ``urls.displayName `` to ``attachment.name ``
487493 (`bridgy-fed#331 <https://github.com/snarfed/bridgy-fed/issues/331 >`__).
494+ - ``from_as1 ``: preserve ``inReplyTo `` object values as objects,
495+ inline single-element lists down down to just single element.
496+ - ``to_as1 ``: use ``objectType: featured `` for first image in
497+ ``image `` field.
498+ - ``to_as1 ``: populate ``actor `` into ``object.author `` for
499+ ``Update ``\ s as well as ``Create ``\ s.
500+ - ``to_as1 ``: convert Mastodon profile metadata ``PropertyValue ``
501+ attachments to ``url `` composite objects with ``displayName ``.
502+ - Preserve ``to `` and ``cc `` values when converting both directions.
488503
489504- ``atom ``:
490505
491506 - Bug fix for rendering image attachments without ``image `` field to
492507 Atom.
508+ - Bug fix for ``published `` and ``updated `` in entries with objects,
509+ eg likes, reposts, RSVPs, bookmarks. Thanks
510+ `@gregorlove <https://gregorlove.com/ >`__!
511+ (`#480 <https://github.com/snarfed/granary/issues/480 >`__)
512+ - Bug fix for content ``activity/ies_to_atom `` when ``object `` is
513+ present and empty.
514+ - Bug fix for objects with elements without ``objectType `` in the
515+ ``to `` field.
516+
517+ - ``flickr ``:
518+
519+ - ``get_activities ``: add support for the ``count `` kwarg.
520+
521+ - ``github ``:
522+
523+ - ``get_activities ``: add support for the ``count `` kwarg.
493524
494525- ``jsonfeed ``:
495526
@@ -502,6 +533,7 @@ Changelog
502533
503534 - Add compatibility support for `Truth
504535 Social <https://truthsocial.com/> `__.
536+ - Handle truncated JSON API responses.
505537
506538- ``microformats2 ``:
507539
@@ -513,27 +545,17 @@ Changelog
513545 attribute
514546 (`bridgy-fed#331 <https://github.com/snarfed/bridgy-fed/issues/331 >`__).
515547 - Add new ``json_to_activities `` function.
548+ - ``hcard_to_html ``/``maybe_linked_name ``: when ``name `` is missing,
549+ use pretty URL as visible text.
516550 - Support the ``h-card `` ``org `` property.
517551 - ``json_to_object ``: handle composite ``rsvp `` property value.
518552 - ``json_to_object ``: bug fix when ``fetch_mf2 `` is True, handle
519553 when we run the authorship algorithm and fetch an author URL that
520554 has a ``u-photo `` with ``alt ``.
521555
522- - ``flickr ``:
523-
524- - ``get_activities ``: add support for the ``count `` kwarg.
525-
526- - ``github ``:
527-
528- - ``get_activities ``: add support for the ``count `` kwarg.
529-
530- 6.0 - 2022-12-03
531- ~~~~~~~~~~~~~~~~
532-
533- - ``as1 ``:
556+ - ``rss ``:
534557
535- - ``activity_changed ``: ignore ``inReplyTo.author ``
536- (`snarfed/bridgy#1338 <https://github.com/snarfed/bridgy/issues/1338 >`__)
558+ - ``from_activities ``: fix item ordering to match input activities.
537559
538560.. _section-1 :
539561
0 commit comments