https://github.com/dadananjesha/twitter-search-api
A minimum viable product written in Python using Django and the Django REST Framework with a sqlite database.
https://github.com/dadananjesha/twitter-search-api
django-application django-rest-framework dockerfile mvp mvt-architecture python3 sql sqlite3 twitter-api
Last synced: 2 months ago
JSON representation
A minimum viable product written in Python using Django and the Django REST Framework with a sqlite database.
- Host: GitHub
- URL: https://github.com/dadananjesha/twitter-search-api
- Owner: DadaNanjesha
- License: mit
- Created: 2021-02-26T21:00:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-11T20:19:39.000Z (over 1 year ago)
- Last Synced: 2026-01-11T20:40:58.063Z (5 months ago)
- Topics: django-application, django-rest-framework, dockerfile, mvp, mvt-architecture, python3, sql, sqlite3, twitter-api
- Language: Python
- Homepage:
- Size: 98.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Twitter Search API (Django project)
A **lightweight and efficient** Twitter Search API built with **Python, Django, and Django REST Framework**. This project utilizes the **Twitter Search API** to fetch, store, filter, and export tweets related to trending events and hashtags.
---
## ๐ Features
- ๐ **Search Twitter** - Fetch recent tweets based on trending hashtags or keywords.
- ๐๏ธ **Store & Retrieve** - Save tweets into a local SQLite database and retrieve them with flexible filtering options.
- ๐ค **Export to CSV** - Export tweet data in CSV format for analysis.
- ๐ฅ๏ธ **REST API Endpoints** - Easily interact with tweet data using well-structured API endpoints.
---
## ๐ API Endpoints
### 1๏ธโฃ **Trigger a Twitter Search**
Fetch tweets for high-traffic hashtags.
```bash
GET /search/?query=YourSearchQuery
```
**Example:** `http://127.0.0.1:8000/search/?query=ElectionDay`
### 2๏ธโฃ **Retrieve Stored Tweets**
Fetch tweets stored in the database with optional filtering.
```bash
GET /twitterSearch/
GET /twitterSearch/?search=YourKeyword
```
**Example:** `http://127.0.0.1:8000/twitterSearch/?search=ko`
### 3๏ธโฃ **Export Tweets to CSV**
Export stored tweets to CSV, selecting relevant columns.
```bash
GET /twitterDataExport/
```
**Example:** `http://127.0.0.1:8000/twitterDataExport/`
---
## ๐ Project Structure

---
## ๐ ๏ธ Installation
1๏ธโฃ **Clone the Repository**
```bash
git clone https://github.com/yourusername/twitter-search-api.git
cd twitter-search-api
```
2๏ธโฃ **Create & Activate Virtual Environment**
```bash
python -m venv env
source env/bin/activate # On Windows use `env\Scripts\activate`
```
3๏ธโฃ **Install Dependencies**
```bash
pip install -r requirements.txt
```
4๏ธโฃ **Run Database Migrations**
```bash
python manage.py migrate
```
5๏ธโฃ **Start the Development Server**
```bash
python manage.py runserver
```
---
## โ๏ธ Environment Variables
To connect to Twitter API, set up the following environment variables:
```bash
TWITTER_API_KEY=
TWITTER_API_SECRET_KEY=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_TOKEN_SECRET=
```
---
## ๐งช Running Tests
Run the test suite to verify functionality:
```bash
python manage.py test
```
---
## ๐ค Contributions
We welcome contributions! ๐ To contribute:
- Fork the repository.
- Create a new branch.
- Implement your changes.
- Submit a pull request.
Ensure that your code is well-documented and includes relevant tests.
---
## โญ๏ธ Call-to-Action
If you find this project helpful, please consider:
- **Starring** the repository to show your support.
- **Forking** to contribute improvements.
- **Following** for updates on future projects.
Your engagement helps boost visibility and encourages further collaboration!
---
## ๐ License
This project is licensed under the [MIT License](LICENSE).
---
๐ **Happy Coding!** ๐