Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/tweets', methods=['GET'])
- def get_tweets():
- client = MongoClient("localhost", 27017)
- db = client['mongo']
- collection = db['pspi students']
- cursor = collection.find({})
- json_docs = []
- for doc in cursor:
- json_doc = json.dumps(doc, default=json_util.default)
- json_docs.append(json_doc)
- return jsonify(json_docs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement