Hi all,
I am getting 404 status code when I am doing any of the operation using CosmosClient.
I have cosmos db (mongo) setup in my subscription. While debugging I could see the "get_database_client"
& "get_container_client" works (as shown in the below screenshot), but all other operations ending with "Status code: 404\nb'', <class 'NoneType'>: None"
Python Packages :
azure-core==1.26.4
azure-cosmos==4.3.1
Python Code:
HOST = config.settings['host']
MASTER_KEY = config.settings['master_key']
DATABASE_ID = config.settings['database_id']
CONTAINER_ID = config.settings['container_id']
def run_sample():
proxy_config = ProxyConfiguration()
proxy = "http://XXXXXXXX.com:8080"
if os.name == 'nt' and proxy is not None:
proxy_config.Host = proxy
client = cosmos_client1.CosmosClient(HOST, credential=MASTER_KEY, proxy_config = proxy_config, consistency_level = 'Session')
db = client.get_database_client(DATABASE_ID)
print ("db link", db.database_link)
container = db.get_container_client(CONTAINER_ID)
try:
for i in range(2, 5):
container.upsert_item({
'id': 'item{0}'.format(i),
'username': 'rishabht_{0}'.format(i),
'type': 'bitbucket',
'token': 'XXXXX'
}
)
except exceptions.CosmosResourceNotFoundError as e:
x =e
print(str(e))