-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_heroku.py
23 lines (20 loc) · 1 KB
/
start_heroku.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from flask import Flask, request, jsonify
from ClassLawr_MongoDB import MongoDB
from ClassLawr_BotWebhook import BotWebhook
app = Flask(__name__)
string = "mongodb+srv://Admin:HIUI#H*[email protected]/test?retryWrites=true&w=majority"
DB = MongoDB(connection_string=string, flag_ssl=True)
token = "654597494:AAFvKQrYz8gw2cR5b5vVcMFzT7D8qI2j27Q"
url = "https://price-compare-bot.herokuapp.com/"
BOT = BotWebhook(token=token, web_address=url)
print('@@@@@@@@@@@@@@ Hello Console PriceCompareBot @@@@@@@@@@@@@@')
@app.route('/', methods=['POST', 'GET'])
def index():
if request.method == 'GET':
document = {'Hello BD': 'PriceCompareBot'}
DB.add_line_to_end(dbs='PriceCompareBot', collection='PriceCompareBot', value=document)
return '@@@@@@@@@@@@@@ Hello Web PriceCompareBot @@@@@@@@@@@@@@'
if request.method == 'POST':
BOT.JSON = request.get_json()
BOT.fast_send("@@@@@@@@@@@@@@ Hello Bot PriceCompareBot @@@@@@@@@@@@@@")
return jsonify(BOT.JSON)