数据工厂中的 PEM 证书

PEM Certificate in Data Factory

在此找不到任何内容。

我正在为英国房地产网站 On the market 打 API。作为授权的一部分,它要求我们提交证书和密钥。文档在这里:

https://media.rightmove.co.uk/ps/pdf/guides/adf/Rightmove_Real_Time_Datafeed_Specification.pdf

(注意:文档指的是 Rightmove,但市场上使用相同的 API)。

我在数据工厂中看不到任何功能可以做到这一点,有没有人能够克服类似的挑战?

我已经从 On-the-market 下载了 PEM 证书。我已尝试使用 Databricks 脚本进行测试,但在尝试加载证书时收到一条错误消息:

Python 脚本:

import http.client
import json
import ssl
 
# Defining certificate related stuff and host of endpoint
certificate_file = "/mnt/data/certificates/otm/certificate17131114507144750725.pem"
certificate_secret= "<snipped>"
host = 'https://adfapi.rightmove.co.uk/v1'
 
# Defining parts of the HTTP request
request_url='/property/getbrandemail'
request_headers = {
    'Content-Type': 'application/json'
}
     
# Define the client certificate settings for https connection
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.load_cert_chain(certfile=certificate_file, password=certificate_secret)
 
# Create a connection to submit HTTP requests
connection = http.client.HTTPSConnection(host, port=443, context=context)
 
# Use connection to submit a HTTP POST request
connection.request(method="POST", url=request_url, headers=request_headers, body=json.dumps(request_body_dict))
 
# Print the HTTP response from the IOT service endpoint
response = connection.getresponse()
print(response.status, response.reason)
data = response.read()
print(data)

错误信息:

FileNotFoundError: [Errno 2] No such file or directory --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) in 20 # Define the client certificate settings for https connection 21 context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) ---> 22 context.load_cert_chain(certfile=certificate_file, password=certificate_secret) 23 24 # Create a connection to submit HTTP requests

明确地说,错误与此行有关:

context.load_cert_chain(certfile=certificate_file, password=certificate_secret)

/mnt/data 是我创建的挂载点,在其他笔记本中也能正常工作。我的想法是通过笔记本获取响应并通过 ADF 对其进行编排。感觉应该有更简单的解决方案。

问题是您使用的代码 /mnt/data 不了解 DBFS(默认文件系统)。所以你需要使用 local filesystem API - 只需将 /dbfs 添加到所有路径,例如 /dbfs/mnt/data/...