我使用 python 中的xlsxwriter模块创建了一个 Excel 工作表。我试图为使用 xlsxwriter 的 data_validation() 方法创建的下拉列表设置默认值。
但是,根据xlsxwriter的文档,如果我们使用validate as list,它没有默认值。
sheet.data_validation('G5', {'validate': 'list',
'source': ['Completed',
'Pending',
'Script Error']})
Run Code Online (Sandbox Code Playgroud)
谁能建议我一些解决办法,在同一单元格中设置默认值和下拉列表?
我有一个 python 脚本,它使用 requests 库通过其 Web 界面连接到设备。它使用带有 https 连接的 url。
sess = requests.Session()
try:
resp = sess.post('https://' + device + '/url_admin/login.cgi', data=login_data, verify=False)
except Exception as e:
template = "Exception: {0}\nArguments: {1!r}"
print(template.format(type(e).__name__, e.args))
Run Code Online (Sandbox Code Playgroud)
当我尝试从命令行执行它时,它工作得很好(即使使用 apache 用户)。然而,当它被来自门户网站的 php 代码(exec 函数)触发时。它抛出这个错误
Exception: ConnectionError
Arguments: (MaxRetryError("HTTPSConnectionPool(host='some.device.com', port=443): Max retries exceeded with url: /url_admin/login.cgi (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f55aa8e6550>: Failed to establish a new connection: [Errno 13] Permission denied',))",),)
Run Code Online (Sandbox Code Playgroud)
我不确定原因是什么,因为 apache 用户能够执行它并建立连接。为什么php代码执行时无法连接?