I try to connect to my documentDB Azure through proxy but i've below error :
raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='xxxxxxx.azure.com', port=xxx): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11004] getaddrinfo failed'))
code below :
#coding:utf-8
from pydocumentdb import document_client
import azure.cosmos.documents as documents
uri = 'xxxxxxx.azure.com:443/'
key = 'xxxxxxxxxx'
connection_policy = documents.ConnectionPolicy()
connection_policy.ProxyConfiguration = documents.ProxyConfiguration()
connection_policy.ProxyConfiguration.Host = 'xxx.xx.xx.xxx'
connection_policy.ProxyConfiguration.Port = xxxx #I also have trid with = 'xxxx'
client = document_client.DocumentClient(uri, {'masterKey': key}, connection_policy)
db_id = 'Store'
db_query = "select * from r where r.id = '{0}'".format(db_id)
db = list(client.QueryDatabases(db_query))[0]
db_link = db['_self']
coll_id = 'collection'
coll_query = "select * from r where r.id = '{0}'".format(coll_id)
coll = list(client.QueryCollections(db_link, coll_query))[0]
coll_link = coll['_self']
query = { 'query': 'select c.date as date from c' }
result_iterable = client.QueryDocuments(coll_link, query)
for item in iter(result_iterable):
date= str(item["date"])