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

Adding ConfigClass for HTTPX #118

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mattjacksoncello
Copy link

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

Copy link

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

Comment on lines 7 to 15

__all__ = [
"client",
"load",
"load_dict",
"models",
"new_client",
"new_client_from_environment"
]

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?

Comment on lines 10 to 15
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)
Copy link

@AndyTitu AndyTitu Jan 28, 2025

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.

@mattjacksoncello
Copy link
Author

Thanks for the review Andy, will refactor the code

@mattjacksoncello
Copy link
Author

@AndyTitu,

I've updated the PR to focus solely on the config class changes as requested. Here are the key updates:

  1. Documentation:

    • Added a new section in USAGE.md documenting the primary use case for CA certificate verification with Connect server
  2. Testing:

    • Created a new test file specifically for the config class implementation
    • Looking for feedback on test coverage and potential edge cases
  3. Examples:

    • Added a new example demonstrating CA file usage in practice

Please review these changes and let me know if any adjustments are needed.

@mattjacksoncello mattjacksoncello marked this pull request as ready for review January 29, 2025 22:04
@mattjacksoncello
Copy link
Author

Hi @AndyTitu

Any updates on this?

Thanks

@mattjacksoncello
Copy link
Author

Hi @AndyTitu
When do you think you will have time to review this? I would like to use the production version if possible.
Thanks

@AndyTitu
Copy link

AndyTitu commented Mar 4, 2025

@mattjacksoncello apologies for missing notifications on this. I'm on it now.

Copy link

@AndyTitu AndyTitu left a comment

Choose a reason for hiding this comment

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

Code looks good to me apart from some small suggestions, thank you for the contribution! ❤️

@AndyTitu
Copy link

AndyTitu commented Mar 5, 2025

@mattjacksoncello some tests are failing for the last changes.

@mattjacksoncello
Copy link
Author

Hi Andy,
I have renamed all instances of cafile to ca_file. Test are now working
Cheers!

@mattjacksoncello
Copy link
Author

@AndyTitu Could you have another look at this please

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