https://github.com/prajwalsrinvas/event_api
An API created using FastAPI to provide information on important events that have occurred on a given day, month or throughout the year.
https://github.com/prajwalsrinvas/event_api
fastapi web-scraping
Last synced: 3 months ago
JSON representation
An API created using FastAPI to provide information on important events that have occurred on a given day, month or throughout the year.
- Host: GitHub
- URL: https://github.com/prajwalsrinvas/event_api
- Owner: Prajwalsrinvas
- Created: 2021-04-20T11:46:56.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-15T05:46:00.000Z (over 3 years ago)
- Last Synced: 2023-03-11T23:41:53.425Z (about 2 years ago)
- Topics: fastapi, web-scraping
- Language: Python
- Homepage: https://events-fastapi.herokuapp.com/
- Size: 1.73 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Events API
An API created using FastAPI to provide us information on important events that have occurred on a given day, month or throughout the year.
## endpoints
- [/](https://events-fastapi.herokuapp.com/) : acts as homepage
- [/events](https://events-fastapi.herokuapp.com/events) : returns all events information
- [/events/today](https://events-fastapi.herokuapp.com/events/today) : returns events that occurred on current month and day
- [/events/{month}](https://events-fastapi.herokuapp.com/events/november) : returns events that occurred on particular month, ex: /months/november
- [/events/{month}/{day}](https://events-fastapi.herokuapp.com/events/november/6) : returns events that occurred on particular day and month, ex: /events/november/6
- [/docs](https://events-fastapi.herokuapp.com/docs) : API documentation automatically created by FastAPI using [Swagger UI](https://swagger.io/tools/swagger-ui/)
- [/redoc](https://events-fastapi.herokuapp.com/redoc): API documentation automatically created by FastAPI using [redoc](https://github.com/Redocly/redoc)## Screenshots
### Homepage

### Documentation

### All events

### Events that occurred on today's date

### Events that occurred on a particular month

### Events that occurred on a particular day of the month

## file descriptions
### [collect_events.py](https://github.com/Prajwalsrinvas/event_api/blob/main/collect_events.py)
- Used to scrape [this site](https://www.onthisday.com/) using requests and BeautifulSoup modules, for all events information.
- Uses functions defined in [scraper.py](https://github.com/Prajwalsrinvas/event_api/blob/main/scraper.py)
- Events information stored as events.json, which is used as source of data by the API### [main.py](https://github.com/Prajwalsrinvas/event_api/blob/main/main.py)
- Serves events information as an API using FastAPI
- Uses functions defined in [services.py](https://github.com/Prajwalsrinvas/event_api/blob/main/services.py)## How to run it?
- python3 collect_events.py
- creates events.json
- events.json file included for convenience
- uvicorn main:app --reload
- deploys API on localhost using uvicorn server## References:
- [FastAPI and Web Scraping in Python - Part 1: Project Setup and Scraping](https://www.youtube.com/watch?v=Nni0HX9O4hc)
- [FastAPI and Web Scraping in Python - Part 2: FastAPI](https://www.youtube.com/watch?v=hOipXax0Ogw)
- [FastAPI Documentation](https://fastapi.tiangolo.com/)