Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.59k stars 2.81k forks source link

clusters_paged.advance_page():AttributeError: 'ItemPaged' object has no attribute 'advance_page' #30361

Open nitvasireddy opened 1 year ago

nitvasireddy commented 1 year ago

The example provided in the document is throwing an error "Object has no attribute".

code provided in doc:

clusters_paged = client.clusters.list() while True:   try:     for cluster in clusters_paged.advance_page():       print(cluster)   except StopIteration:      break

Error :

Failed Traceback (most recent call last): File "C:\Temp\zfgbxetj.3wr\576342fb-aa67-42ed-a216-c097325b5d43", line 41, in for cluster in clusters_paged.advance_page():AttributeError: 'ItemPaged' object has no attribute 'advance_page'

Working code with modifications:

clusters_paged = client.clusters.list() for cluster_page in clusters_paged.by_page():     for cluster in cluster_page:         print(cluster)

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

github-actions[bot] commented 1 year ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aim-for-better @idear1203 @deshriva.

xiangyan99 commented 1 year ago

Thanks for the feedback.

Could you provide more information including which package did you use and the version number?

Thank you.

github-actions[bot] commented 1 year ago

Hi @nitvasireddy. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

nitvasireddy commented 1 year ago

Hi,

Thanks for checking the issue filed. Below are details requested.

Package used : azure_mgmt_hdinsight version: 9.0.0 I'm using "HDInsightManagementClient" to list the clusters. Please let me know if you need any additional details.

Regards, Nithin Vasireddy | Support Engineer | Azure Big Data Office: +1 (469) 7751353 | @.**@.> M-F 08:00 am - 05:00 PM CST

If you require immediate assistance on your support request outside of my working hours, please email @.**@.> with case number and brief details on your request. If you have any feedback about me or my work, please feel free to reach out to my manager Samir Vora @.**@.> or myself.

Share your HDInsight Ideashttps://feedback.azure.com/d365community/forum/14770d6d-7626-ec11-b6e6-000d3a4f032c

From: Xiang Yan @.> Sent: Friday, May 12, 2023 12:41 PM To: Azure/azure-sdk-for-python @.> Cc: Nithin Vasireddy @.>; Author @.> Subject: Re: [Azure/azure-sdk-for-python] clusters_paged.advance_page():AttributeError: 'ItemPaged' object has no attribute 'advance_page' (Issue #30361)

Thanks for the feedback.

Could you provide more information including which package did you use and the version number?

Thank you.

- Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-sdk-for-python/issues/30361#issuecomment-1546075861, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A7YUNFNFYA234WLPJO2PHFDXFZY23ANCNFSM6AAAAAAX6MVSXY. You are receiving this because you authored the thread.Message ID: @.**@.>>

xiangyan99 commented 1 year ago

Thanks for the information.

Looks like the return of the list() method is an ItemPaged[Cluster] https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py#L1603.

It is by design that it does not have advance_page attribute.

github-actions[bot] commented 1 year ago

Hi @nitvasireddy. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

nitvasireddy commented 1 year ago

Thanks correct, which is why we need to update the documentation providing the working examples.

Regards, Nithin Vasireddy | Support Engineer | Azure Big Data Office: +1 (469) 7751353 | @.**@.> M-F 08:00 am - 05:00 PM CST

If you require immediate assistance on your support request outside of my working hours, please email @.**@.> with case number and brief details on your request. If you have any feedback about me or my work, please feel free to reach out to my manager Samir Vora @.**@.> or myself.

Share your HDInsight Ideashttps://feedback.azure.com/d365community/forum/14770d6d-7626-ec11-b6e6-000d3a4f032c

From: Xiang Yan @.> Sent: Monday, May 15, 2023 11:54 AM To: Azure/azure-sdk-for-python @.> Cc: Nithin Vasireddy @.>; Mention @.> Subject: Re: [Azure/azure-sdk-for-python] clusters_paged.advance_page():AttributeError: 'ItemPaged' object has no attribute 'advance_page' (Issue #30361)

Thanks for the information.

Looks like the return of the list() method is an ItemPaged[Cluster] https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py#L1603.

It is by design that it does not have advance_page attribute.

- Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-sdk-for-python/issues/30361#issuecomment-1548210737, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A7YUNFMIHICL4IH4DYHJDFTXGJNRJANCNFSM6AAAAAAX6MVSXY. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiangyan99 commented 1 year ago

Get it. Thanks for reporting the issue.