What and where is the recommended way to handle st...
# singer-tap-development
f
What and where is the recommended way to handle status_code 204 - No content, when there is no new data in inremental sync?
v
each api is different, there's no standard
f
I solved it. Don't know if it is the most elegant way. Thanks anyway.
Copy code
def parse_response(self, response: requests.Response) -> Iterable[dict]:
        """Parse the response and return an iterator of result rows."""
        # TODO: Parse response body and return a set of records.
        if(response.status_code == 204):
            return None
        
        yield from extract_jsonpath(self.records_jsonpath, input=response.json())
and
Copy code
def get_next_page_token(
        self, response: requests.Response, previous_token: Optional[Any]
    ) -> Optional[Any]:
        """Return a token for identifying next page or None if no more pages."""

        if(response.status_code == 204):
            return None
...
v
Is that what you want to happen when a 204 is thrown? What does it mean when the api gives you a 204?
I've seen it for queue based things where the server is lets say generating a report for you, so it says "Hey I'm making the report, come check back later for it to be done"
f
In my case, 204 means successfully requested, but there is no new data available, e.g. if you have a bookmarked timestamp from the last run, but there is no new data for the new scheduled run.