Python中的Google Cloud Function在部署时出现错误

我正在尝试配置Google Cloud Functions以在触发该功能时下订单。 我在kiteconnect文件中提到了requirements.txt 但是该功能未部署。引发错误“未知资源类型”。

完整错误消息:

Deployment failure: Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT","errorMessage": "`pip_download_wheels` had stderr output:\nCommand \"python setup.py egg_info\" failed with error code 1 in /tmp/pip-wheel-97dghcl9/logging/\n\nerror: `pip_download_wheels` returned code: 1","errorType": "InternalError","errorId": "67DBDBF3"}}

有人有处理云功能以在Zerodah下达交易订单的经验吗?

以下是我尝试过的功能:

import logging
from kiteconnect import KiteConnect

logging.basicConfig(level=logging.DEBUG)

kite = KiteConnect(api_key="xxxxxxxxxxxxxxxxxxxxxxxx")

# Redirect the user to the login url obtained
# from kite.login_url(),and receive the request_token
# from the registered redirect url after the login flow.
# Once you have the request_token,obtain the access_token
# as follows.

data = kite.generate_session("xxxxxxxxxxxxxxxxxxxxxxxxx",secret="xxxxxxxxxxxxxxxxxxxxxxxxxx")
kite.set_access_token(data["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"])

# Place an order
def orderPlace():
    order_id = kite.place_order(
        variety=kite.VARIETY_REGULAR,exchange=kite.EXCHANGE_NSE,tradingsymbol="INFY",transaction_type=kite.TRANSactION_TYPE_BUY,quantity=1,product=kite.PRODUCT_CNC,order_type=kite.ORDER_TYPE_MARKET
    )

    logging.info("Order placed. ID is: {}".format(order_id))
except Exception as e:
    logging.info("Order placement failed: {}".format(e.message))

Requirements.txt文件的内容:

# Function dependencies,for example:
# package>=version
kiteconnect
mycindy123 回答:Python中的Google Cloud Function在部署时出现错误

该错误表明您的依赖项之一是可卸载的。

看起来kiteconnect依赖项当前与Python 3.7不兼容,这是Cloud Functions在其运行时使用的Python版本:https://github.com/zerodhatech/pykiteconnect/issues/55

您需要等到维护者发布与Python 3.7兼容的新版本。

本文链接:https://www.f2er.com/3161053.html

大家都在问