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

Feat/entity attributes #3

Merged
merged 4 commits into from
Mar 9, 2023
Merged

Feat/entity attributes #3

merged 4 commits into from
Mar 9, 2023

Conversation

amatmv
Copy link
Member

@amatmv amatmv commented Mar 9, 2023

No description provided.

self._items,
self._count,
) = Result.parse_page(json.loads(r.text))
if r.status_code == requests.codes.ok:

Choose a reason for hiding this comment

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

requests has a function for it

Suggested change
if r.status_code == requests.codes.ok:
if is_success(r.status_code):

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't find the method you suggest, instead I used the "ok" property

Choose a reason for hiding this comment

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

oh, sorry, it's from DRF 😅

@@ -74,23 +88,46 @@ def get_self_link(self):
def get_first_link(self):
return self._link_first

@staticmethod
def parse_page(json_data):
@classmethod

Choose a reason for hiding this comment

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

Why this change if you don't use anything from cls?

Copy link
Member Author

Choose a reason for hiding this comment

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

In case some day someone decides to inherit this class and customize that method

Choose a reason for hiding this comment

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

You can override a staticmethod too, but nevermind

@amatmv amatmv merged commit e77c38d into master Mar 9, 2023
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