Issue
I am trying to make a messenger bot using Wit.ai. For that I need a webhook. I am using ngrok, and this is just a test file but I am getting this error.
This is the error I am getting.
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
Traceback (most recent call last):
File "app.py", line 56, in <module>
app.run(debug = True, port = 80)
File "/home/parth/.local/lib/python3.6/site-packages/flask/app.py", line 990, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 988, in run_simple
s.bind(server_address)
PermissionError: [Errno 13] Permission denied
This is the code
import os, sys
from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET'])
def verify():
# Webhook verification
if request.args.get("hub.mode") == "subscribe" and request.args.get("hub.challenge"):
if not request.args.get("hub.verify_token") == "hello":
return "Verification token mismatch", 403
return request.args["hub.challenge"], 200
return "Hello world", 200
if __name__ == "__main__":
app.run(debug = True, port = 80)
Thanks!
Solution
You're getting that error because you're using a Privileged Port.
The TCP/IP port numbers below 1024 are special in that normal users are not allowed to run servers on them.
...
When you run a server as a test from a non-priviliged account, you will normally test it on other ports, such as 2784, 5000, 8001 or 8080.
Change your port to 5000, for example, and that will fix your problem.
Answered By - Tiago Martins Peres
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.