-
Notifications
You must be signed in to change notification settings - Fork 32
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
Adding ConfigClass for HTTPX #118
base: main
Are you sure you want to change the base?
Conversation
If you're new to commit signing, there are different ways to set it up: Sign commits with
|
e57cb7f
to
52c721f
Compare
|
||
__all__ = [ | ||
"client", | ||
"load", | ||
"load_dict", | ||
"models", | ||
"new_client", | ||
"new_client_from_environment" | ||
] |
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.
Won't deleting this block avoid these components from being properly exported from this package?
src/tests/test_client_vaults.py
Outdated
SS_CLIENT_ASYNC = client.new_client(HOST, TOKEN, True) | ||
# Create clients using new config pattern | ||
client_config = ClientConfig(url=HOST, token=TOKEN) | ||
SS_CLIENT = client.Client(client_config) | ||
|
||
async_config = AsyncClientConfig(url=HOST, token=TOKEN) | ||
SS_CLIENT_ASYNC = async_client.AsyncClient(async_config) |
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.
@mattjacksoncello could you also add a section in the description about the use-case you are trying to unlock by passing certificate paths to the client and to httpx, and manual steps for testing this new feature you are attempting to add, as well as maybe add some unit tests that attempt to retrieve items while having this certificate setting turned on?
All these would help speed up the review.
src/onepasswordconnectsdk/client.py
Outdated
def new_client(url: str, token: str, is_async: bool = False) -> Union[AsyncClient, Client]: | ||
def new_client(url: str, token: str, **kwargs) -> Client: |
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.
This change is not backwards compatible unfortunately, and other existing user scripts will break if we ever released this and those users updated to this new version. To support this new separation we'd have to release a new major version of the SDK, namely 2.0, and I'm not sure it's worth it only to separate the client initialisation function.
Don't get me wrong, I do agree that this would probably be a better pattern, it's just that I don't believe that this improvement alone is worth releasing a 2.0. Can we maybe revert this client separation and only keep the client config part of this PR?
Thanks for the review Andy, will refactor the code |
7a710d1
to
0bb9f60
Compare
bd01b8b
to
3fa8e90
Compare
77b11a9
to
c2e521c
Compare
I've updated the PR to focus solely on the config class changes as requested. Here are the key updates:
Please review these changes and let me know if any adjustments are needed. |
This PR is to implement a config class to allow more control over httpx for things like certificate verification.
I have also merged in the changes from #92
Note: I have used Claude to help with the changes. I have reviewed everything but I am not the strongest coder so there may be mistakes that I have missed