fred_reimer
01/31/2022, 7:51 PMedgar_ramirez_mondragon
01/31/2022, 8:08 PMaaronsteers
01/31/2022, 11:50 PMstate_partitioning_keys
to exclude that extra field from state tracking logic. In the case of github issues have comments, the issue itself knows the count of comments and if the count of comments is 0
, then there's no need to hit the comments API.
Does this help for your use case?aaronsteers
01/31/2022, 11:51 PMfred_reimer
02/01/2022, 12:56 AMdef request_records(self, context: Optional[dict]) -> Iterable[dict]:
"""Call super to yield rows only if the security token exists for the AccountId."""
if str(context["accountId"]) in self.config.get("security_account_tokens"):
# Save context as authenticator is called by prepare_request without passing context
self._security_token = self.config["security_account_tokens"][
str(context["accountId"])
]
for row in super().request_records(context):
yield row
and I setup an authenticator property that pulls the value:
@property
def authenticator(self) -> APIKeyAuthenticator:
"""Return a new authenticator object."""
return APIKeyAuthenticator.create_for_stream(
self, key="X-API-TOKEN", value=self._security_token, location="header"
)
aaronsteers
02/01/2022, 1:05 AM