我正在尝试使用Azure Machine Learning studio中的以下python脚本写入Cosmos DB,但是我收到以下错误:
注意:相同的代码在MS WorkBench / VS中正常工作。
错误消息:
文件" C:\ pyhome \ lib \ site-packages \ requests \ adapters.py",第447行, send raise SSLError(e,request = request)SSLError :('写 操作超时',)
PYTHON SCRIPT
import os
import sys
import pandas as pd
path = os.path.dirname("./Script Bundle/") + "/PYPackage/"
sys.path.append(path)
from pydocumentdb import document_client as document_client
# The entry point function can contain up to two input arguments:
# Param<dataframe1>: a pandas.DataFrame
# Param<dataframe2>: a pandas.DataFrame
def azureml_main(dataframe1 = None, dataframe2 = None):
# Execution logic goes here
# If a zip file is connected to the third input port is connected,
# it is unzipped under ".\Script Bundle". This directory is added
# to sys.path. Therefore, if your zip file contains a Python file
# mymodule.py you can import it using:
# import mymodule
config = { 'ENDPOINT':
'https://xxxxxxxxxxxxxxxx.documents.azure.com','MASTERKEY': '2O1yyxxxxxxxxxxxxxhjfj5jclWCXImDxxxxxxxxxxxxjlwAQ==','DOCUMENTDB_DATABASE': 'testpythoncolllll','DOCUMENTDB_COLLECTION':
'xxxxxxxxxxxxxx'};
# Initialize the Python DocumentDB client
client = document_client.DocumentClient(config['ENDPOINT'], {'masterKey':
config['MASTERKEY']})
# Create a database
db = client.CreateDatabase({ 'id': config['DOCUMENTDB_DATABASE'] })
# Create collection options
options = {
'offerEnableRUPerMinuteThroughput': True,
'offerVersion': "V2",
'offerThroughput': 400
}
# Create a collection
collection = client.CreateCollection(db['_self'], { 'id':
config['DOCUMENTDB_COLLECTION'] }, options)
document1 = client.CreateDocument(collection['_self'],
{
'id': 'server1',
'Web Site': 0,
'Cloud Service': 0,
'Virtual Machine': 0,
'name': 'some'
})