[英]Google Cloud Function in Python gives an error on deploying
I am trying to configure Google Cloud Functions to place an order when the function is triggered.我正在尝试配置 Google Cloud Functions 以在触发 function 时下订单。 I have mentioned
kiteconnect
in the requirements.txt
file But the function doesn't get deployed.我在
requirements.txt
文件中提到了kiteconnect
但是 function 没有部署。 throws an error "Unknown resource type".引发错误“未知资源类型”。
FULL ERROR MESSAGE:完整的错误信息:
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"}}
Does anyone have any experience dealing with cloud functions to place a trading order on zerodah?有没有人有处理云功能在 zerodah 下交易订单的经验?
Following is the function that i have tried:以下是我尝试过的 function:
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))
Content of requirements.txt file: requirements.txt 文件内容:
# Function dependencies, for example:
# package>=version
kiteconnect
The error indicates that one of your dependencies is uninstallable.该错误表明您的依赖项之一是可卸载的。
It looks like the kiteconnect
dependency is currently incompatible with Python 3.7, which is the Python version Cloud Functions uses in it's runtime: https://github.com/zerodhatech/pykiteconnect/issues/55 It looks like the
kiteconnect
dependency is currently incompatible with Python 3.7, which is the Python version Cloud Functions uses in it's runtime: https://github.com/zerodhatech/pykiteconnect/issues/55
You'll need to wait until the maintainers release a new version that is compatible with Python 3.7.您需要等到维护人员发布与 Python 3.7 兼容的新版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.