Skip to content

Instantly share code, notes, and snippets.

@lmazuel
Created October 29, 2020 21:13
Show Gist options
  • Save lmazuel/8e1e1e812204e9698a3d3a434cb68061 to your computer and use it in GitHub Desktop.
Save lmazuel/8e1e1e812204e9698a3d3a434cb68061 to your computer and use it in GitHub Desktop.
Paging brainstorm
# I want to use headers and not JSON to get next Link, and the Swagger didn't help
class MyPagingMethod(PagingProtocol):
def extract_continuation_token(self, pipeline_response, deserialized):
return pipeline_response.http_response.headers["x-ms-continuation-token"]
client.list(paging_method=MyPagingMethod())
# I want to use headers and not JSON to get next Link
client.list()
because
``json
x-ms-pageable:
nextLinkHeader: x-ms-continuation-token
def extract_continuation_token(pipeline_response, deserialized): # cuztomisable
return pipeline_response.http_response.headers["x-ms-continuation-token"]
# I want to use body to get next Link, but Swagger says it's headers
class MyPagingMethod(PagingProtocol):
def extract_continuation_token(self, pipeline_response, deserialized):
return deserialized.next_link or None
client.list(paging_method=MyPagingMethod())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment