如何获取使用Python触发Azure函数的inputBlob的名称 [英] How Do I get the Name of The inputBlob That Triggered My Azure Function With Python

查看:94
本文介绍了如何获取使用Python触发Azure函数的inputBlob的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个azure函数,该函数由放入blob存储中的文件触发,我想知道如何(如果可能)获取触发该函数的blob(文件)的名称,我尝试这样做:

I have an azure function which is triggered by a file being put into blob storage and I was wondering how (if possible) to get the name of the blob (file) which triggered the function, I have tried doing:

fileObject=os.environ['inputBlob']
message = "Python script processed input blob'{0}'".format(fileObject.fileName)

fileObject=os.environ['inputBlob']
message = "Python script processed input blob'{0}'".format(fileObject.name)

但是这些都不起作用,它们都导致错误.我可以从中获得一些帮助或建议吗?

but neither of these worked, they both resulted in errors. Can I get some help with this or some suggesstions?

谢谢

推荐答案

关于您在说明中使用的触发条件,没有任何信息.但幸运的是,GitHub上有一个示例项目 yokawasa/azure-functions-python-samples for Azure Function使用Python,其中包含许多使用不同触发器的示例,例如

There is not any information about what trigger you used in your description. But fortunately, there is a sample project yokawasa/azure-functions-python-samples on GitHub for Azure Function using Python which includes many samples using different triggers like queue trigger or blob trigger. I think it's very helpful for you now, and you can refer to these samples to write your own one to satisfy your needs。

希望有帮助.

这篇关于如何获取使用Python触发Azure函数的inputBlob的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆