microsoft / microsoft/typespec
[python] Add support for paging through callbacks as kwargs
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
Original issue [here](https://github.com/Azure/autorest.python/issues/665).
Expected syntax for code user:
```python
from azure.core.paging import PagingMethod
class SearchPaging(PagingMethod):
def __init__(self, *args, **kwargs):
# do things
def get_next(self, continuation_token):
# do things
return get_next_return
def extract_data(get_next_return):
# do things
return continuation_token, current_page
pager = client.list_all(paging=SearchPaging(**params))
for item in pager:
print(item)
```
Azure-core impact:
```python
class PagingMethod(abc):
@abc.abstractmethod
def get_next(self, continuation_token):
# do things
return get_next_return
@abc.abstractmethod
def extract_data(get_next_return):
# do things
return continuation_token, current_page
# FIXME
```
Contributor guide
Assessment
This issue has not been assessed yet.