im adding the whole code. when i run it i started getting a syntax error although when i first coded it i received no such error. Also when i try to push to heroku i get language not detected so i added a python build packet for language detection and still recieved the same error i am re writing the code by hand now although i tried to copya and past also tried comman git puch heroku HEAD:master and git heroku push HEAD:main and both did not work although i did get heroku push to work it put it on master branch and did not install the necessies to make it work remotely. i am building a python binance webhook bot
here is the code
mport json, config
from flask import Flask, request,jsonify
from binance.client import Client
from binance.enums import *
app = Flask(name)
client = Client(config.API_KEY, config.API_SECRET, tld=‘us’)
def order(side, quantity, symbol,order_type=ORDER_TYPE_MARKET):
try:
print(f"sending order {order_type} - {side} {quantity} {symbol}" )
order = client.create_order(symbol=symbol, side=side, type=order_type, quantity=quantity)
except Exception as e:
print(“an exception occured - {}”.format(e))
return False
return order
@app.route(’/’)
def hello_world():
return ‘Hello, World!’
@app.route(’/webhook’, methods=[‘POST’])
def webhook():
#print(request.data)
data = json.loads(request.data)
if data["passphrase"] != config.WEBHOOK_PASSPHRASE:
return {
"code": "error",
"message": "Nice try, invalid passphrase"
}
print(data['ticker'])
print(data['bar'])
side = data['strategy']['order_action'].upper()
quantity = data['strategy']['order_contracts']
order_response = order(side, quantity, "BTCUSD")
if order_response:
return {
"code": "success",
"message": "order executed"
}
else:
print("order failed")
return {
"code": "error",
"message": "order failed"
}
that is the entire bot outside the file containing api and password information
also i get
binance.client import Client, AsyncClient # noqa as a post in terminal after i remade the python bot