Proxy is not respected
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- azure, python
- Domaine
- api, networking
Piste de recherche
Commencez par GraphClientFactory.create_with_default_middleware et GraphRequestAdapter, puis comparez la requête directe de AsyncClient avec la requête de GraphServiceClient. Reproduisez le délai d’attente avec la configuration de proxy fournie et vérifiez si l’AsyncClient configuré est conservé à travers le middleware et l’adaptateur. Le travail est terminé lorsque les requêtes Graph utilisent le proxy configuré au lieu d’expirer.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I followed the steps here and its not using the proxy at all. My requests just time out: https://learn.microsoft.com/en-us/graph/sdks/customize-client?tabs=python#configuring-the-http-proxy-for-the-client
While normal requests using httx work, the requests to Azure do not. I'm guessing that this new client is not accepted somewhere down the chain
import asyncio
from azure.identity.aio import ClientSecretCredential
from django.conf import settings
from httpx import AsyncClient
from kiota_authentication_azure.azure_identity_authentication_provider import (
AzureIdentityAuthenticationProvider,
)
from msgraph import GraphRequestAdapter, GraphServiceClient
from msgraph.generated.users.users_request_builder import UsersRequestBuilder
from msgraph_core import GraphClientFactory
def get_azure_client() -> tuple[GraphServiceClient, AsyncClient]:
credential = ClientSecretCredential(
settings.AZURE_TENANT_ID, settings.AZURE_CLIENT_ID, settings.AZURE_CLIENT_SECRET # type: ignore
)
auth_provider = AzureIdentityAuthenticationProvider(
credential, scopes=["https://graph.microsoft.com/.default"]
)
# see: https://learn.microsoft.com/en-us/graph/sdks/customize-client?tabs=python#configuring-the-http-proxy-for-the-client
httpx_proxies = {
"http://": settings.INTERNET_PROXY,
"https://": settings.INTERNET_PROXY,
}
http_client = AsyncClient(proxies=httpx_proxies) # type: ignore
http_client = GraphClientFactory.create_with_default_middleware(client=http_client)
adapter = GraphRequestAdapter(auth_provider, http_client)
return GraphServiceClient(request_adapter=adapter), http_client
async def amain() -> None:
client, http_client = get_azure_client()
await http_client.get("https://microsoft.com") # this works
await client.groups.by_group_id( # this times out
settings.AZURE_GROUP_ID
).transitive_members.get()
if __name__ == "__main__":
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
loop.run_until_complete(amain())
except KeyboardInterrupt:
pass
/cc @nejch
- Langage dominant
- Python
- Étoiles
- 630
- Forks
- 96
- Merge moyen
- 15 h 20 min
- PR mergées (30 j)
- 3
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de microsoftgraph/msgraph-sdk-python
-
status:waiting-for-triage type:bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
microsoftgraph/msgraph-sdk-python#1570 ·
-
status:waiting-for-triage type:bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
microsoftgraph/msgraph-sdk-python#1563 ·
-
Needs: Attention :wave: type:bug
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
microsoftgraph/msgraph-sdk-python#1287 · 2 commentaires · 1 réaction ·
-
status:waiting-for-triage type:bug
Difficulté 3/5 1-2 jours Accessibilité débutants 52/100
microsoftgraph/msgraph-sdk-python#1578 ·
-
Batch Request Support Ouvertestatus:waiting-for-triage
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
microsoftgraph/msgraph-sdk-python#1557 ·
Toutes les issues de microsoftgraph/msgraph-sdk-python
Issues similaires
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
canonical/paas-charm#368 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
tech debt
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
addition to tracking list Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
StevenBlack/hosts#3256 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
qualcomm/qai-appbuilder#275 ·