-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathride.py
More file actions
30 lines (25 loc) · 1012 Bytes
/
ride.py
File metadata and controls
30 lines (25 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pymongo.mongo_client import MongoClient
from flask import Flask, request, jsonify, session, flash, render_template, redirect, url_for
from pymongo.server_api import ServerApi
from dotenv import load_dotenv
load_dotenv()
import os
import json
#uri = "mongodb+srv://rayant:gcVuoLoTz830GZmx@cluster0.4eebirt.mongodb.net/?retryWrites=true&w=majority"
# Create a new client and connect to the server
client = MongoClient(os.getenv('MONGODB_URI'), server_api=ServerApi('1'))
db = client[os.getenv("MONGODB_DATABASE")]
def test_conn():
# Send a ping to confirm a successful connection
try:
client.admin.command('ping')
print("Pinged your deployment. You successfully connected to MongoDB!")
except Exception as e:
print(e)
# @app.route('/submit-text', methods=['POST'])
# def upload_file():
# data = request.form
# print(data)
# # Create a new client and connect to the server
# collection = db[os.getenv("MONGODB_COLLECTION")]
# collection.insert_one(data)