-
Notifications
You must be signed in to change notification settings - Fork 571
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
Custom headers/cookies in InferenceClient #1507
Conversation
The documentation is not available anymore as the PR was closed or merged. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1507 +/- ##
==========================================
+ Coverage 82.18% 82.19% +0.01%
==========================================
Files 57 57
Lines 6089 6093 +4
==========================================
+ Hits 5004 5008 +4
Misses 1085 1085
☔ View full report in Codecov by Sentry. |
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.
LGTM
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.
Looks good to me, would like to know @Narsil's thoughts on it given that it's working with the inference API
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.
Yup LGTM.
I am guessing this comment relies on the undelying lib, but cookies is a header, I'm kind of curious of what happens if you set both to different values.
@Narsil to satisfy your curiosity: import curl
import requests
curl.parse(requests.get("http://www.google.com", headers={"Cookie": "foo=bar"}))
curl.parse(requests.get("http://www.google.com", cookies={"foo": "something", "abc": "def"}))
curl.parse(requests.get("http://www.google.com", headers={"Cookie": "foo=bar"}, cookies={"foo": "something", "abc": "def"})) which outputs
Conclusion:
And thanks all 3 for the reviews! :) |
I love having my curiosity satisfied. Must be has caused a lot of headaches :) |
Related to huggingface/api-inference-community#287 (and especially huggingface/api-inference-community#287 (comment)) cc @StephenHodgson @Narsil
With this PR, user can set custom headers and cookies to the
InferenceClient
session. This can prove useful when using custom endpoints. If set, custom headers overwrite the default user-agent and authorization headers.(+fix documentation => save audio as .flac instead of .wav)