gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
31.7k stars 2.36k forks source link

Forward custom authentication mechanism to httpx #8754

Closed valgai closed 4 weeks ago

valgai commented 1 month ago

Is your feature request related to a problem? Please describe.
We deployed a Gradio app behind a proxy which requires Kerberos authentication. When accessing the app from the browser, there is no problem, but the trouble begins when using the API with gradio_client. There is currently, AFAIK, no way to forward custom authentication mechanism to httpx such as httpx_kerberos or httpx-negotiate-sspi.

Describe the solution you'd like
I wish the gradio_client.client.Client constructor would accept an authentication mechanism that would be forwarded to httpx calls.

Additional context I wrote a minimal implementation here : c4622ea05. It works well for our usecases, but I don't know about the edge cases.

Thanks for your help !

abidlabs commented 1 month ago

Hi @valgai yes we could add this. Would you be able to open a PR with your work so far and we can review it and modify it as needed?

valgai commented 1 month ago

Of course, I just created one.