I recently tried to deploy my telegram bot on Heroku and I use Flask framework for write webhook code. With using "git push heroku master" deploying my codes began with any problems, But at the end I encountered this problem that the link "https://git.heroku.com/serene-crag-92322.git" I get "Method Not Allowed" message. Please help me to solve this problem and thank you in advance.
My Flask code:
#app.route('/' + TOKEN, methods=['POST'])
def getMessage():
json_string = request.get_data().decode('utf-8')
update = telebot.types.Update.de_json(json_string)
bot.process_new_updates([update])
return "!", 200
#app.route("/")
def webhook():
bot.remove_webhook()
bot.set_webhook(
url='https://gentle-temple-77151.herokuapp.com/' + TOKEN)
return "!", 200
if __name__ == "__main__":
app.run()
The message from Heroku:
Heroku creates a git repository with your source code before building and deploying your code. You had tried to access that private Git repository, which is not accessible to the outside world (therefore, the Method Not Allowed error message appeared). But the actual website where your web app is deployed is different. That web app includes your app name, if you had given one during Heroku app creation, else a random name is given to your web app.
Heroku Git Repository Link: https://git.heroku.com/serene-crag-92322.git
Deployed Heroku App Link: http://serene-crag-92322.herokuapp.com/
Related
NOT : I only have rcon password
I want to retrieve the logs on the csgo server, but I couldn't do it.
I can use c# nodejs and python
I created a project in replit using python and flask and with logaddress_add_http.I added the link of this project to the csgo server and it worked, but I could not figure out how to get the logs by adding the ip of my own computer with the logaddress_add to the csgo server.
Please help me, I couldn't find any sources about this
log on
logaddress_add_http "https://CSGO.synx12.repl.co"
My Code:
from flask import Flask,request
app=Flask(__name__)
#app.route("/",methods=["GET","POST"])
def index():
if(request.method=="GET"):
return "GET"
elif(request.method=="POST"):
data=request.get_data()
print(data)
return f"Data : {data}"
if(__name__=="__main__"):
app.run(host="0.0.0.0",port=8080)
I'm sending a message to the server with rcon
And Result
here logaddress_add_http works fine but I couldn't get logaddress_add to work at all
I want your help for this.
I am trying to deploy a simple REST API using Chalice. My basic boilerplate is
from chalice import Chalice
app = Chalice(app_name='helloworld')
#app.route('/')
def index():
return {'hello': 'world'}
When I call chalice local and run it on localhost 8000, there is no issue and I am able to get back the returns. However, after I deployed it and used the REST API URL that was returned, it didn't work anymore. I keep getting the
{"message": "Internal server error"}
I would appreciate any help!
Thanks!
Good news, it looks like you are reaching your lambda.
Check aws cloudwatch logs: /aws/lambda/helloworld-{dev|prod}
If can't solve it, upload .chalice/config.json and the error of the logs in clouwatch
Basically I just booted up an older script that I made 1-2 months ago and which worked perfectly at the time, but now when I try to connect to the ngrok tunnel i get a 404 and a "Tunnel xxxx not found"
I have a non-paying user, which didn't use to be a problem and I cant see anywhere that they changed their terms of service and I can find the tunnel on the dashboard but not connect, any idea what is wrong and if they changed something?
I just booted an old super simple test script which also doesn't work, I can see the tunnel but it returns "Funnel xxxx not found" and server 404:
from flask import Flask
from flask_ngrok import run_with_ngrok
app = Flask(__name__)
run_with_ngrok(app) #starts ngrok when the app is run
#app.route("/")
def home():
return "<h1>Running Flask on Google Colab!</h1>"
app.run()
I have built a SMS service (using Twilio) that the user texts to get realtime bus information. At the moment i have been hosting this on my personal computer using ngrok. Now i want to use AWS to host this service, but I am not sure as to how i should go about it. I have tried running a flask webserver and trying to get ngrok to run on AWS, but no luck.
Here is my code concerning Flask and Twilio's REST Api:
app = Flask(__name__)
#app.route("/sms", methods=['GET', 'POST'])
def hello_monkey():
resp = MessagingResponse()
response = request.form['Body']
if (" " in response):
response = response.split(" ")
result = look_up(response[0], response[1])
else:
result = look_up(response, False)
resp.message(result)
return str(resp)
if __name__ == "__main__":
app.run(debug=True)
There is a blog post on the Twilio blog on How to Send SMS Text Messages with AWS Lambda and Python 3.6. It does not use Flask, but it can definitely be modified to achieve your goal. Alternatively, you could read about using Flask with AWS Elastic Beanstalk here.
Running ngrok on AWS is not the correct approach to this. If you wanted to host your own Flask server, you could use something like Lightsail, but that's overkill for this usage.
I just created one web app with the help of Flask and Heroku but when I started using session for log in stuff then in local (in my computer) its working fine but when I deployed it on heroku then its showing error: Internal Server Error
Can anyone help me with this ?
#app.route('/')
def home():
''' Home page'''
if 'username' in session:
session['logged_in'] = True
else:
session['logged_in'] = False
return render_template('home.html')
As soon as it come to 'if' line then server stops and shows error but if i run this locally then it works fine. I just pasted the small part of my code showing where it shows error.
Is it possible that for heroku we need to implement it differently or heroku doesn't support session.
Check if you have set app.config['SECRET_KEY']. If not, flask will report an error.