Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve all objects from list_devices endpoint #53

Merged
merged 3 commits into from
Jul 30, 2019

Conversation

hwnjng
Copy link
Contributor

@hwnjng hwnjng commented Jul 29, 2019

The original PR was taking in per_page param to then list out all objects by hitting the api endpoints until next metadata was null (more specifically, calling the api total % per_page times). But, decided to just create a new function,list_all_devices that gets rid of per_page. This was due to the fact that the end goal is to return everything anyway and thus the number of items per page becomes arbitrary.


This change is Reviewable

@hwnjng hwnjng requested a review from patrickdevivo July 29, 2019 20:06
@patrickdevivo patrickdevivo requested a review from mmlb July 29, 2019 20:46
Copy link
Contributor

@patrickdevivo patrickdevivo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @hwnjng, @mmlb, and @patrickdevivo)


packet/Manager.py, line 76 at r1 (raw file):

    def list_all_devices(self, project_id):
        all_devices = list()

maybe declare this down below right before it's used, like in between the while and the for loop? just cause it only becomes relevant later in the code. not a big deal

Copy link
Contributor

@patrickdevivo patrickdevivo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @hwnjng and @mmlb)

@hwnjng hwnjng merged commit 82e6034 into packethost:master Jul 30, 2019
@hwnjng hwnjng deleted the new_list_paginate branch July 30, 2019 14:03
johnalotoski pushed a commit to input-output-hk/packet-python that referenced this pull request Aug 12, 2019
* added support to retrieve all devices regardless of pagination

* cleanup of Manager.py and added TODO test

* fmt and lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants