import tweepy
from tweepy import OAuthHandler
customer_key = "***"
customer_secret = "***"
access_token = "***"
access_secret = "***"
auth = OAuthHandler(customer_key, customer_secret)
auth.set_access_token(access_token, access_secret)
api = tweepy.API(auth)
from pymongo import MongoClient
client = MongoClient()
db = client.twitterDb
posts = db.modiPosts
import json
tweets = api.search(q = "#modi", count = 100)
for tweet in tweets:
    posts.insert_one(tweet._json)
posts = db.tenKtweets
tweets = api.search(q = "place:b850c1bfd38f30e0", count = 500)
for tweet in tweets:
    posts.insert_one(tweet._json)
posts = db.commonwealth
tweets = api.search(q = "#kathua", count = 200)
for tweet in tweets:
    posts.insert_one(tweet._json)
posts = db.music
tweets = api.search(q = "#music", count = 200)
for tweet in tweets:
    posts.insert_one(tweet._json)
place = api.geo_search(query = "India", granularity = 'country')
print(place[0].id)