简体   繁体   English

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

[英]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.

相关问题 使用依赖项使用 Google Cloud Functions 部署 Python 函数时出错 - Error deploying Python function using Google Cloud Functions using dependencies 部署到 Google Cloud Function:错误消息:'main' - Deploying to Google Cloud Function: Error message: 'main' 从控制台或 console.cloud.google.com/functions/edit 部署 Python GCP 云函数时出现 INVALID_ARGUMENT 错误 - INVALID_ARGUMENT error when deploying Python GCP Cloud Function from either console or console.cloud.google.com/functions/edit 在谷歌云上部署 python 文件 - Deploying python file on google cloud 试图在谷歌云中找到已部署的 python function 的当前项目 ID 给出错误 - trying to find the current project id of the deployed python function in google cloud gives error 在 Google Cloud Platform 上的 Google Cloud Function 中执行 Python 脚本时出错 - Error on executing Python script in Google Cloud Function on Google Cloud Platform 使用 Tensorflow 部署 Google Cloud Function 失败 - Deploying Google Cloud Function with Tensorflow fails 在 Google Cloud Platform 上部署 python 脚本 - Deploying a python script on Google Cloud Platform Google Cloud Function:“错误:超出内存限制。函数调用被中断。” 部署 NLP 模型时 - Google Cloud Function: "Error: memory limit exceeded. Function invocation was interrupted." when deploying NLP model Python 谷歌云 Function - Python Google Cloud Function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM