简体   繁体   中英

Calling Watson Discovery API from behind a HTTP Proxy server using Python SDK

I'm using Watson Python SDK https://github.com/watson-developer-cloud/python-sdk to send the search request to Watson Discovery service, but I'm behind a http proxy and not able to reach to the Watson Discovery service.

Could you please advice me to modify to execute this python script(watson-developer-cloud/python-sdk) in HTTP proxy environment ?

from watson_developer_cloud import DiscoveryV1

discovery = DiscoveryV1(
  username=username,
  password=password,
  version="2017-11-07"
)

collection = discovery.get_collection(environment_id, collection_id)

You can use the set_http_config() function provided

http_config = {
    "proxies": {
        "https": "URL",
        "http": "URL"
    }
}
discovery.set_http_config(http_config)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM