fabston / TradingView-Webhook-Bot

📊 Send TradingView alerts to Telegram, Discord, Slack, Twitter and Email.
MIT License
1.26k stars 392 forks source link

regarding webhook url #2

Closed quanthero closed 4 years ago

quanthero commented 4 years ago

Hello, in your readme section, you mentioned that Your webhook url would be http://YOUR-IP/webhook. so YOUR-IP should be my local or cloud server address? but in main.py file, is there any change to the code?

kroil commented 4 years ago

Hi @quanthero

You'd have to use your external IP. To find out your IP check out ifconfig. Nothing has to be changed in main.py.

Let me know if anything is still unclear.

quanthero commented 4 years ago

Hi @quanthero

You'd have to use your external IP. To find out your IP check out ifconfig. Nothing has to be changed in main.py.

Let me know if anything is still unclear.

Thanks. I already fix the ip address. But comes bugs when move the codes to cloud.

(tv-hook) [root@iZj6c4oie16kr4xsxsbnixZ TradingView-Webhook-Bot]# python main.py Serving on http://0.0.0.0:80 Alert Received: Sell Alert! BTCUSDT, 1 Crossing Down Parabolic SAR (0.02, 0.02, 0.2) ERROR:main:Exception on /webhook [POST] Traceback (most recent call last): File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/flask/_compat.py", line 39, in reraise raise value File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "main.py", line 23, in webhook send_sell_order(data) File "/data/servers/TradingView-Webhook-Bot/handler.py", line 65, in send_sell_order response = discord_alert.execute() File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/discord_webhook/webhook.py", line 117, in execute response = requests.post(url, json=self.json, proxies=self.proxies) File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/requests/api.py", line 119, in post return request('post', url, data=data, json=json, kwargs) File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/requests/sessions.py", line 516, in request prep = self.prepare_request(req) File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/requests/sessions.py", line 459, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/requests/models.py", line 314, in prepare self.prepare_url(url, params) File "/data/servers/TradingView-Webhook-Bot/tv-hook/lib64/python3.6/site-packages/requests/models.py", line 388, in prepare_url raise MissingSchema(error) requests.exceptions.MissingSchema: Invalid URL '': No schema supplied. Perhaps you meant http://? Alert Received: Sell Alert! BTCUSDT, 1 Crossing Down Parabolic SAR (0.02, 0.02, 0.2) ERROR:main:Exception on /webhook [POST]

kroil commented 4 years ago

I assume you are trying to send the alert to discord only? I just tried it myself without any issues. I just pushed a little update but doubt that would solve your issue...

img img

quanthero commented 4 years ago

I assume you are trying to send the alert to discord only? I just tried it myself without any issues. I just pushed a little update but doubt that would solve your issue...

img img

got you. thanks!

kroil commented 4 years ago

Glad it worked out!