From f2bbc5a1c4f85fa4126e7e19da8727e3ecf019ab Mon Sep 17 00:00:00 2001 From: Sam Hames Date: Mon, 12 Sep 2022 14:33:23 +1000 Subject: [PATCH] Add __twarc metadata to list_lookup returned data Just a small oversight: it's useful to have this if you want to investigate how a list changes over time. --- twarc/client2.py | 8 +++++++- twarc/version.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/twarc/client2.py b/twarc/client2.py index 40cff088..a6a0058c 100644 --- a/twarc/client2.py +++ b/twarc/client2.py @@ -606,7 +606,13 @@ def list_lookup(self, list_id, expansions=None, list_fields=None, user_fields=No if expansions: params["expansions"] = "owner_id" url = f"https://api.twitter.com/2/lists/{list_id}" - return self.get(url, params=params).json() + resp = self.get(url, params=params) + data = resp.json() + + if self.metadata: + data = _append_metadata(data, resp.url) + + return data def list_tweets( self, diff --git a/twarc/version.py b/twarc/version.py index 0b8f08d4..d9ecc585 100644 --- a/twarc/version.py +++ b/twarc/version.py @@ -1,5 +1,5 @@ import platform -version = "2.11.2" +version = "2.11.3" user_agent = f"twarc/{version} ({platform.system()} {platform.machine()}) {platform.python_implementation()}/{platform.python_version()}"