July 2017
Intermediate to advanced
374 pages
8h
English
This function gets the complete list of tweets from all the users.
Let's update our list_tweets() method to begin getting the list of tweets from the tweets collection of MongoDB using the following code snippet:
def list_tweets():
api_list=[]
db = connection.cloud_native.tweet
for row in db.find():
api_list.append(str(row))
return jsonify({'tweets_list': api_list})
Now that we have updated the code, let's test it out on POSTMAN. The following screenshot lists all the tweets by making an API request using POSTMAN:
