Hey everyone, happy friday! :tada: I'm trying out...
# troubleshooting
s
Hey everyone, happy friday! 🎉 I'm trying out the cool new pagination feature, and am experiencing some issues: When running the tap, I am getting this error:
Copy code
TypeError: MyPaginator.get_next_url() missing 1 required positional argument: 'previous_token'
Is this normal? I have not overwritten get_next_url (don't even have it in my
client.py
) What's the best method to debug this? Is there a quick fix? Thanks 😄
e
You’re probably returning a class instead of an instance in
get_new_paginator
. It should be
Copy code
class MyStream(RESTStream):
  def get_new_paginator(self):
    return MyPaginator()
s
I'll check it out, thanks @edgar_ramirez_mondragon 😄 Also, would you know if data.get supports nested json values?
Hum, seems to still not like me... what functions does
get_next_url
depend upon?
e
data
in the example shared above is a dictionary of the API response so it certainly supports arbitrary nested json values, e.g.
data.get("some_object",  {}).get("a_nested_value")
You might wanna checks the unit tests for a custom hateoas pagination to see if there’s any problems in your implementation: https://github.com/meltano/sdk/blob/ad0c2d34b1f94063ab006464eb9bb393d44ddd9c/tests/core/rest/test_pagination.py#L294-L309
s
@edgar_ramirez_mondragon in your test you do not mention a previous token - is this normal?
Also also (I'm just flooding you with questions, I apologize) - is there a setting in the sdk to replace the existing url with a new one? The API I am working with returns the full url to the next page, not just a path to take on to the base url
e
in your test you do not mention a previous token - is this normal?
Yeah it’s normally not required, but if you need to access the previous pagination value, there’s a
current_value
read-only property.
I’m just flooding you with questions, I apologize
Oh, no worries! Happy to help and hopefully uncover a gap in the docs or an actual 🐛
is there a setting in the sdk to replace the existing url with a new one? The API I am working with returns the full url to the next page, not just a path to take on to the base url
Not really, but there’s an example of how to parse the “next URL” to get the query params here: https://sdk.meltano.com/en/latest/classes/singer_sdk.pagination.BaseHATEOASPaginator.html#singer_sdk.pagination.BaseHATEOASPaginator
s
Awesome! I'll look into that and get back to you when I inevitably have more questions