This Python project uses the Twitter API to monitor tweets addressed to Chandigarh police with specific hashtags (#chandigarhpolice, #crime, #pcr) and stores them in a MongoDB database. Authorized users can access the stored tweets through a web interface.
Before running the project, ensure you have the following:
- Python 3.x installed
- MongoDB installed and running locally
- Twitter Developer Account with API credentials
-
Clone the GitHub repository:
git clone https://github.com/your-username/twitter-chandigarh-police.git cd twitter-chandigarh-police
-
Install the required Python packages:
pip install tweepy Flask Flask-PyMongo bson
-
Set up Twitter API credentials:
- Replace the placeholders in the
tweepy.py
file with your Twitter API credentials:consumer_key
consumer_secret
key
secret
- Replace the placeholders in the
-
Set up MongoDB:
- Make sure MongoDB is running on your local machine.
- Modify the
app.config['MONGO_URI']
in theapp.py
file if your MongoDB setup requires a different URI.
-
Start the Twitter monitoring script:
python tweepy.py
This script continuously monitors Twitter for tweets addressed to Chandigarh police with the specified hashtags and stores them in the MongoDB database.
-
Start the web application:
python app.py
The web interface will be accessible at
http://localhost:5000
. Users can log in and view the stored tweets.
- Login: Users can log in using their credentials.
- Logout: Users can log out of their accounts.
- View Tweets: Users can view tweets stored in the MongoDB database.
- Post Tweets: Users can post new tweets to the database.
If you'd like to contribute to this project, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your changes to your fork.
- Create a pull request to the main repository.
This project is licensed under the MIT License - see the LICENSE file for details.
- This project was created by [Your Name].
- Special thanks to the Chandigarh Police for their dedication to public safety.
If you have any questions or need assistance, please feel free to contact [Your Email Address].
Enjoy using the Twitter to MongoDB Web Interface for Chandigarh Police!