A simple github bot to retrieve data from github and track user activity:
- BeautifulSoup
- Requests
- FastAPI
- Flask
Clone the project:
git clone https://github.com/jassics/learning-python.git
Navigate to the GhBot:
cd projects/GhBot/
Install using conda:
conda create -n ghbot python=3.9
conda activate ghbot
pip install -r requirements.txt
Run the Script:
python main.py -u "your_github_username"
Run the API:
uvicorn api:app --reload
Run the UI app:
python app.py
Open browser and navigate to http://127.0.0.1:5000/
-
Test the local api created with
fastapiusing python:python post.py -u "enter_github_username" -
Test the local api with
CURL:For
Windowsusers:curl -X POST -H "Content-Type: application/json" -d '{ \"text\" : \"deepraj1729\" }' http://127.0.0.1:8000/ghbotFor
LinuxandMacusers:curl -X POST -H "Content-Type: application/json" -d '{ "text" : "deepraj1729" }' http://127.0.0.1:8000/ghbot -
Test the production api with
CURL:For
Windowsusers:curl -X POST -H "Content-Type: application/json" -d '{ \"text\" : \"deepraj1729\" }' https://ghbot-api.herokuapp.com/ghbotFor
LinuxandMacusers:curl -X POST -H "Content-Type: application/json" -d '{ "text" : "deepraj1729" }' https://ghbot-api.herokuapp.com/ghbot -
Useful formatting with python
jsonlibrary:For
Windowsusers:curl -X POST -H "Content-Type: application/json" -d '{ \"text\" : \"deepraj1729\" }' https://ghbot-api.herokuapp.com/ghbot | python -m json.toolFor
LinuxandMacusers:curl -X POST -H "Content-Type: application/json" -d '{ "text" : "jassics" }' https://ghbot-api.herokuapp.com/ghbot | python -m json.tool



