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

Fix Incorrect Proxy Setting Usage in Request Module #83

Merged
merged 3 commits into from
Jul 23, 2024

Conversation

t-tani
Copy link
Contributor

@t-tani t-tani commented Jun 17, 2024

Description

The current implementation of the proxy setting in the search function does not handle proxies correctly. Specifically, if a proxy is set with the format http://proxy_host:port, it does not handle https requests to proxy, which is required for Google search.

Related Issues

#73

Solution

This PR updates the proxy setting logic to correctly configure the proxy for both http and https protocols when the proxy URL starts with http:// or https://. This ensures that https requests are properly routed through the proxy even when the proxy URL is specified with http://.

Changes Made

Updated the proxy setting logic to configure proxies for both http and https protocols properly.

Old Code

if proxy:
    if proxy.startswith("https"):
        proxies = {"https": proxy}
    else:
        proxies = {"http": proxy}

New Code

if proxy.startswith("http://") or proxy.startswith("https://"):
    proxies = {
        "https": proxy,
        "http": proxy
    }

Copy link
Owner

@Nv7-GitHub Nv7-GitHub left a comment

Choose a reason for hiding this comment

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

Seems good, I will merge this in a future release!

@t-tani
Copy link
Contributor Author

t-tani commented Jul 19, 2024

I have updated the proxy settings to align with the current style in __init__.py

@Nv7-GitHub
Copy link
Owner

Thank you! I'll merge this and get it into a release soon!

@Nv7-GitHub Nv7-GitHub merged commit 6b8b8bd into Nv7-GitHub:master Jul 23, 2024
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