-
Notifications
You must be signed in to change notification settings - Fork 198
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
Initialize headers from config in reset_base_headers() #707
base: master
Are you sure you want to change the base?
Conversation
59d6862
to
544ae2f
Compare
OK, here's some idea that could work. Don't mind the PR title and body, will update them once the PR comes useful. So, WDYT, is this acceptable? |
'X-Plex-Device': plexapi.X_PLEX_DEVICE, | ||
'X-Plex-Device-Name': plexapi.X_PLEX_DEVICE_NAME, | ||
'X-Plex-Client-Identifier': plexapi.X_PLEX_IDENTIFIER, | ||
'X-Plex-Platform': CONFIG.get('header.platorm', CONFIG.get('header.platform')), |
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.
Maybe it's about time to drop support for the 'header.platorm'
typo?
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.
it was fixed in 2018, matching 3.2.0 version:
How about this approach? If needed, I could extract to smaller changes. |
I still don’t see the point. IMO you need to add a example on why this is better. Fix your flake errors, run the test suit locally, including the tests for the client and squash the commits. I don’t like the name reset_default_headers as isn’t anymore, is the headers is in config file (it was a bad name in the first place) Why is the headers a local variable the class? Why not use it directly? |
for section in self._sections: | ||
for name, value in self._sections[section].items(): | ||
if name != '__name__': | ||
config[section.lower()][name.lower()] = value | ||
return dict(config) | ||
|
||
def _defaults(self): | ||
from uuid import getnode |
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.
Don’t in-line std libs.
from platform import uname | ||
from plexapi import PROJECT, VERSION | ||
|
||
platform_name, device_name, platform_version = uname()[0:3] |
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.
Fix the slicing.
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.
Explain fix how? fix what? what is wrong with the current code?
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.
why is the current slicing wrong. how is the correct way?
I don't see point fixing tests until it's certain this is worth finishing! That's why I asked about the changes, not the style! Also, do note the PR is in a Draft state. |
I used an existing name, please suggest a better name not only complain it's bad.
|
I think I explained it in an issue this PR is referring to (#706). to make the headers instance-based, not global. so the since Config object may be modified runtime (after ps: since Github has no threading in comment mode, submit a review as code comments, so can reply in a thread and resolve disucssions. |
1c5505d
to
89f8bff
Compare
WIP: #706