Taegis SDK for Python のプロキシ設定🔗
Taegis SDK for Python は、AIOHTTPクライアントライブラリを通じて、クエリ/ミューテーションおよびサブスクリプションの両方でプロキシをサポートしています。
関連する入力項目:
trust_envproxyproxy_authproxy_headersssl
trust_env は、コンストラクタまたはコンテキストマネージャに渡すことで、環境からプロキシ設定を取得できます。これは AIOHTTPトランスポート によって処理されます。認証は、環境変数 HTTP_PROXY、HTTPS_PROXY、WS_PROXY、WSS_PROXY を介して渡すことができます。NetRCも認証の提供に利用できます。trust_env とプロキシパラメータは排他的であり、proxy、proxy_auth、proxy_headers パラメータが両方指定された場合やサービスコンテキストに渡された場合は優先されます。
from taegis_sdk_python import GraphQLService
service = GraphQLService(trust_env=True)
results = service.subjects.query.current_subject()
print(results)
または
from taegis_sdk_python import GraphQLService
service = GraphQLService()
with service(trust_env=True):
results = service.subjects.query.current_subject()
print(results)
プロキシ設定は、コンストラクタまたはサービスマネージャに直接渡すこともできます。
from taegis_sdk_python import GraphQLService
from aiohttp import BasicAuth
service = GraphQLService(
proxy="http://your.proxy.domain:port",
proxy_auth=BasicAuth("<username>", "<password>")
)
results = service.subjects.query.current_subject()
print(results)
または
from taegis_sdk_python import GraphQLService
from aiohttp import BasicAuth
service = GraphQLService()
with service(
proxy="http://your.proxy.domain:port", proxy_auth=BasicAuth("<username>", "<password>")
):
results = service.subjects.query.current_subject()
print(results)
SSL設定も SSLContext を通じて渡すことができます。