-
Notifications
You must be signed in to change notification settings - Fork 1
Add compatibility for DLCs #10
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
base: master
Are you sure you want to change the base?
Conversation
shaunikm
commented
Jun 28, 2022
- Pull data from https://botw-compendium.herokuapp.com/api/v2/master_mode in addition to the base URL
Fixed syntax issue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work @shaunikm. Just added a few comments. Please address them before I merge.
pyrule_compendium/__init__.py
Outdated
""" | ||
|
||
def __init__(self, base_url: str="https://botw-compendium.herokuapp.com/api/v2", default_timeout: Union[int, float, None]=None): | ||
def __init__(self, base_url: str="https://botw-compendium.herokuapp.com/api/v2", default_timeout: Union[int, float, None]=None, master_mode: bool = False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think master_mode
should be passed into the functions rather than to the class, because we do not want to create another object for master_mode
data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that having master_mode
passed when the class is initialized would remove the need for a redundant parameter in every function of the class.
timeout = self.default_timeout | ||
|
||
res: dict = self.api.request(f"/entry/{entry}", timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan on adding a dlc
field to entry data in v3. Until then, is there a better way of determining if it is master_mode
or not without two requests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than using local data, I don’t see any way to determine if an entry is from master_mode
without two requests.
if res: return False | ||
|
||
res = self.master_api.request(f"/entry/{entry}", timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too many requests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I don’t see a way to minimize the number of requests we have here other than using local data.
- Can also override class parameter `master_mode`
…` with `master_mode`
Reduce number of requests when calling function