Python Azure Blob存储输入流不完整
我有读取XML文件的Azure Blob触发函数。
def main(myblob: func.blob.InputStream):
logging.info(f"Python blob trigger function processed blob \n"
f"Name: {myblob.name}\n")
data = myblob.read()
logging.info(data)
data = ET.fromstring(data)
return
注意该函数是使用VSCODE功能创建的,
我会发现一个错误,当我检查Azure Insights logs for Azure函数时,数据通过XML解析器畸形
,看来它没有完全读取XML文件。
XML文件约为150kb约4000行。对不起,不能举例说明它超过字符限制。
看起来它会截断文件输出。
无论如何是否有充分阅读Blob文件?
谢谢
I have azure blob trigger function that reads xml files.
def main(myblob: func.blob.InputStream):
logging.info(f"Python blob trigger function processed blob \n"
f"Name: {myblob.name}\n")
data = myblob.read()
logging.info(data)
data = ET.fromstring(data)
return
Note the function was created using the vscode feature
I get an error that the data is malformed when the data is goes through the XML parser
When I check the Azure Insights Logs for the Azure Function, it seems that it does not fully read the xml file.
The XML file is around 150KB around 4000 lines. Sorry cannot give an example as it exceeds character limit here.
It looks like it truncates the file output.
Is there anyway to fully read the blob file?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它晚了,但我仍然会写信,因为它可能会对他人有所帮助。
还有另一种可用的选项可以读取文件,即我们可以在用blob触发的情况下使用SAS创建一个用于文件的URL,然后您可以使用该URL从Blob存储中获取文件。
这是一个示例: -
您可以使用URL获取文件。我希望这会有所帮助。
Its late but I will still write as it might help others.
There is another option available to read files i.e. we can create a url with SAS for file when it is triggered with blob and then you can use that url to fetch file from blob storage.
here is an example:-
you can use url to get the file. I hope this helps.