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 You.com Provider #1825

Merged
merged 1 commit into from
Apr 12, 2024
Merged

Fix You.com Provider #1825

merged 1 commit into from
Apr 12, 2024

Conversation

hlohaus
Copy link
Collaborator

@hlohaus hlohaus commented Apr 11, 2024

No description provided.

Copy link

Hello H Lohaus,

Thank you for contributing to the project. Here's the review for your pull request titled "Fix You.com Provider":


Pull Request Review

Author: H Lohaus

Title: Fix You.com Provider

Code Changes:

diff --git a/g4f/Provider/You.py b/g4f/Provider/You.py
index 7816b07af5..be4ab52309 100644
--- a/g4f/Provider/You.py
+++ b/g4f/Provider/You.py
@@ -164,7 +164,9 @@ async def create_cookies(cls, client: StreamSession) -> Cookies:
             headers={
                 "Authorization": cls.get_auth(),
                 "X-SDK-Client": cls.get_sdk(),
-                "X-SDK-Parent-Host": cls.url
+                "X-SDK-Parent-Host": cls.url,
+                "Origin": "https://you.com",
+                "Referer": "https://you.com/"
             },
             json={
                 "dfp_telemetry_id": await get_dfp_telemetry_id(),

Review:
The addition of the Origin and Referer headers is a good practice for ensuring that requests to the You.com provider are recognized as coming from a legitimate source. This can help with both security and tracking the source of the requests.

Recommendations:

  • Ensure that the Origin and Referer values are dynamically set to match the environment from which the requests are made.
  • Add tests to verify that the headers are set correctly and that they function as intended in different scenarios.

Overall, the changes are clear and well-implemented. Great job on this fix!


I appreciate your effort in improving the project. Looking forward to more of your valuable contributions!

Best,
Microsoft Copilot

@hlohaus hlohaus merged commit 35179fe into xtekky:main Apr 12, 2024
1 check passed
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.

1 participant