From c0257515e8dc648d7d317be54a346ab66ff9170e Mon Sep 17 00:00:00 2001 From: vijay Date: Sun, 19 Dec 2021 14:07:29 +0530 Subject: [PATCH 1/9] Removed error handling for 404 --- src/app.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/app.py b/src/app.py index fb6f350..7692e0e 100644 --- a/src/app.py +++ b/src/app.py @@ -30,10 +30,6 @@ def favicon(): mimetype="image/vnd.microsoft.icon", ) - @app.errorhandler(404) - def page_not_found(e): - return "ERROR 404: CANNOT GET {}".format(request.path) - app.register_blueprint(api_blueprint) return app From 14bd0fd9f1a2b01f795adc6badc43a1f009e8490 Mon Sep 17 00:00:00 2001 From: vijay Date: Tue, 21 Dec 2021 22:43:48 +0530 Subject: [PATCH 2/9] Updated ebDetails.json example --- examples/ebDetails.json | 585 ++++++++++++++++++++-------------------- 1 file changed, 292 insertions(+), 293 deletions(-) diff --git a/examples/ebDetails.json b/examples/ebDetails.json index 12fb03b..a819900 100644 --- a/examples/ebDetails.json +++ b/examples/ebDetails.json @@ -1,295 +1,294 @@ { - "2021": { - "Admin Department": { - "Club coordinator": [ - { - "Name": "Asish Kumar Dalai", - "Position": "Club Coordinator", - "Discord": "-", - "Email": "asish.d@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/asish-kumar-dalai-7b25ab169?originalSubdomain=in", - "GitHub": "-", - "Description": "-" - } - ], - "Community leader": [ - { - "Name": "S Vijay Balaji", - "Position": "Community Leader", - "Discord": "StranGe#9634", - "Email": "vijaykumar.19bce75741@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/svijayb/", - "GitHub": "https://github.com/SVijayB", - "Description": "The more you sweat in peace, the less you bleed in war." - } - ], - "President": [ - { - "Name": "Datta Adithya G V", - "Position": "President", - "Discord": "Hel#3566", - "Email": "adithya.19bce7119@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/datta-adithya/", - "GitHub": "https://github.com/dat-adi", - "Description": "Kind of a pogchamp." - } - ], - "Director": [ - { - "Name": "S.V.HarshaVardhan", - "Position": "Director", - "Discord": "cody07#0153", - "Email": "harshavardhan.19BCD7149@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/harsha-samudrala-3ba66a216/", - "GitHub": "https://github.com/harsha0703", - "Description": "Think different for a better future. " - } - ], - "Treasurer": [ - { - "Name": "Lakshmi Teja P", - "Position": "Treasurer", - "Discord": "Lakshmi Teja#5620", - "Email": "lakshmi.19bcn7002@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/lakshmi-teja-bb45861a1/", - "GitHub": "https://github.com/LakshmiTejaP", - "Description": "A simple soul who gets really excited when the sky is in pretty colors." - } - ], - "Vice president": [ - { - "Name": "Bhargavi Chada", - "Position": "Vice President", - "Discord": "bhargavi#2592", - "Email": "bhargavi.19bcn7021@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/bhargavi-chada/", - "GitHub": "https://github.com/BhargaviChada", - "Description": "I like trains." - } - ], - "Secretary": [ - { - "Name": "Ojasva Jain", - "Position": "Secretary", - "Discord": "Ojasva#4398", - "Email": "ojasva.20bcn7062@vitap.ac.in ", - "LinkedIn": "https://www.linkedin.com/in/ojasva-jain-9958071b2", - "GitHub": "https://github.com/ojasva", - "Description": "Windows user, but Open source supporter. " - } - ], - "Head of public relations": [ - { - "Name": "Tarini Guttula", - "Position": "Head of public relations", - "Discord": "Tarini#3832", - "Email": "tarini.19bce7758@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/tarinig/", - "GitHub": "https://github.com/tatiniG/", - "Description": "when day dreams become reality" - } - ], - "Track lead": [ - { - "Name": "Dhruv Jha", - "Position": "Track lead", - "Discord": "fullmeteor172#9084", - "Email": "dhruv.21bce7902@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/dhruv-jha-2002/", - "GitHub": "https://github.com/fullmeteor172", - "Description": "Not lazy, just on power saving mode ;-;" - } - ], - "Hr lead": [ - { - "Name": "Angel Maria Stanley", - "Position": "HR Lead", - "Discord": "BlacDarc#9677", - "Email": "maria.21bce7363@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/angel-stanly-218a0893/", - "GitHub": "https://github.com/Maiden23", - "Description": "I dont know , and who cares , nobody is gonna read this anyways XD." - } - ] - }, - "Event Department": { - "Event lead": [ - { - "Name": "T. Chethan", - "Position": "Event lead", - "Discord": "Chethan#4848", - "Email": "tirpati.19bce7427@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/chethan-tirupati-523251194", - "GitHub": "https://github.com/chethantirupati", - "Description": "" - }, - { - "Name": "M V S S Maruti Kameshwar", - "Position": "Event lead", - "Discord": "maruti kameshawar#5033", - "Email": "maruti.19bce7243@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/maruti-kameshwar-6b8846215/", - "GitHub": "https://github.com/marutikameshwar", - "Description": "" - } - ], - "Social media lead": [ - { - "Name": "Ch.Sabareesh Reddy", - "Position": "Social Media Lead", - "Discord": "Sabareesh Reddy#1907", - "Email": "sabareesh.19bce7210@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/sabareesh-reddy-chowkacherla-6834a6196/", - "GitHub": "https://github.com/Sabareesh000", - "Description": "" - } - ], - "Organizer": [ - { - "Name": "Rahul Alokkan", - "Position": "Organizer", - "Discord": "RA7#0512", - "Email": "rahul.20bcn7006@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/rahul-alokkan-16384b196/", - "GitHub": "https://github.com/Rahul-Alokkan", - "Description": "Tech Entusiast " - }, - { - "Name": "Nishita Singh", - "Position": "Organizer", - "Discord": "Nishita Singh#8630", - "Email": "nishita.21bce8684@vitapstudent.ac.in", - "LinkedIn": "", - "GitHub": "", - "Description": "" - } - ] - }, - "Tech Department": { - "Technical lead": [ - { - "Name": "N. Krishna Raj", - "Position": "Technical Lead", - "Discord": "KodeReaper#7759", - "Email": "krishna.19bce7357@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/n-krishna-raj/", - "GitHub": "https://github.com/kode-logger", - "Description": "Octocats never die, they only Evolve." - }, - { - "Name": "Sai Pranay", - "Position": "Technical Lead", - "Discord": "sai pranay#9087", - "Email": "pranay.20bci7061@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/saipranay47/", - "GitHub": "https://github.com/saipranay47", - "Description": "I build things for the web" - }, - { - "Name": "GVS Sai Madhav", - "Position": "Technical Lead", - "Discord": "DarthVader#3395", - "Email": "surya.19bcn7228@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/gvssmadhav", - "GitHub": "https://github.com/gvssaimadhav", - "Description": "Soon, We Are Going to Live in the Era of AI." - } - ], - "Developer": [ - { - "Name": "Mahesh Dasika", - "Position": "Developer", - "Discord": "Tech-Dynamo#5367", - "Email": "mahesh.20bci7075@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/mahesh-d-178b681b8/", - "GitHub": "https://github.com/mahesh-11102", - "Description": "Tech and Auto enthusiast" - }, - { - "Name": "Aryan Mohanty", - "Position": "Developer", - "Discord": "Aryan Mohanty#1066", - "Email": "aryan.21bce8377@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/aryan-mohanty-230160221/", - "GitHub": "https://GitHub.com/AryanVIT", - "Description": "Better never means better for everyone it always means worse for some" - }, - { - "Name": "Ashutosh Patel", - "Position": "Developer", - "Discord": "Ashutosh#8081", - "Email": "ashutosh.20bce7053@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/ashutosh-patel-a828a4221/", - "GitHub": "https://github.com/ashu168", - "Description": "Don't complain just work harder" - }, - { - "Name": "A. Loukya", - "Position": "Developer", - "Discord": "loukya#7114", - "Email": "loukya.21bce7404@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/adepu-loukya-67a345221/", - "GitHub": "https://github.com/A-Loukya", - "Description": "" - } - ] - }, - "Design Team": { - "Head of marketing": [ - { - "Name": "P. Kaarthik Sai", - "Position": "Head of marketing", - "Discord": "CYRUS PLAGUE#3634", - "Email": "Kaarthik.19bcd7142@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/kaarthik-patibandla-30017219a/", - "GitHub": "https://github.com/kaarthik01", - "Description": "That which does not kill us makes us stronger" - } - ], - "Chief editor": [ - { - "Name": "Chirag Gupta", - "Position": "Chief Editor", - "Discord": "chiragg#1721", - "Email": "chirag.20bce7453@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/chirag-gupta-8a16161ba", - "GitHub": "https://github.com/chiragg06", - "Description": "I overthink the niche." - } - ], - "Head of videography": [ - { - "Name": "M Abhiram Kalyan", - "Position": "Head of videography", - "Discord": "Abhiram#3959", - "Email": "kalyan.19bcd7118@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/abhiram-kalyan-883445190/", - "GitHub": "https://github.com/abhiram-kalyan", - "Description": "" - } - ], - "Documentation specialist": [ - { - "Name": "Sai Shaket Kalivarapu", - "Position": "Documentation Specialist", - "Discord": "Fushiguro#6451", - "Email": "shaket.19bce7547@vitap.ac.in", - "LinkedIn": "https://www.linkedin.com/in/sai-shaket-kalivarapu-51327618a/", - "GitHub": "https://github.com/KilluaZ06", - "Description": "I try to be the fun one" - } - ], - "Designer": [ - { - "Name": "Praseeda kallakuri", - "Position": "Designer", - "Discord": "praseeda kallakuri#8374", - "Email": "praseedha.21bce8649@vitapstudent.ac.in", - "LinkedIn": "https://www.linkedin.com/in/praseeda-kallakuri-970334221", - "GitHub": "https://github.com/praseedakallakuri", - "Description": "creative soul!!" - } - ] - } - } + "Admin Department": { + "Club coordinator": [ + { + "Name": "Asish Kumar Dalai", + "Position": "Club Coordinator", + "Discord": "-", + "Email": "asish.d@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/asish-kumar-dalai-7b25ab169?originalSubdomain=in", + "GitHub": "-", + "Description": "-" + } + ], + "Community leader": [ + { + "Name": "S Vijay Balaji", + "Position": "Community Leader", + "Discord": "StranGe#9634", + "Email": "vijaykumar.19bce75741@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/svijayb/", + "GitHub": "https://github.com/SVijayB", + "Description": "The more you sweat in peace, the less you bleed in war." + } + ], + "President": [ + { + "Name": "Datta Adithya G V", + "Position": "President", + "Discord": "Hel#3566", + "Email": "adithya.19bce7119@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/datta-adithya/", + "GitHub": "https://github.com/dat-adi", + "Description": "Kind of a pogchamp." + } + ], + "Director": [ + { + "Name": "S.V.HarshaVardhan", + "Position": "Director", + "Discord": "cody07#0153", + "Email": "harshavardhan.19BCD7149@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/harsha-samudrala-3ba66a216/", + "GitHub": "https://github.com/harsha0703", + "Description": "Think different for a better future. " + } + ], + "Treasurer": [ + { + "Name": "Lakshmi Teja P", + "Position": "Treasurer", + "Discord": "Lakshmi Teja#5620", + "Email": "lakshmi.19bcn7002@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/lakshmi-teja-bb45861a1/", + "GitHub": "https://github.com/LakshmiTejaP", + "Description": "A simple soul who gets really excited when the sky is in pretty colors." + } + ], + "Vice president": [ + { + "Name": "Bhargavi Chada", + "Position": "Vice President", + "Discord": "bhargavi#2592", + "Email": "bhargavi.19bcn7021@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/bhargavi-chada/", + "GitHub": "https://github.com/BhargaviChada", + "Description": "I like trains." + } + ], + "Secretary": [ + { + "Name": "Ojasva Jain", + "Position": "Secretary", + "Discord": "Ojasva#4398", + "Email": "ojasva.20bcn7062@vitap.ac.in ", + "LinkedIn": "https://www.linkedin.com/in/ojasva-jain-9958071b2", + "GitHub": "https://github.com/ojasva", + "Description": "Windows user, but Open source supporter. " + } + ], + "Head of public relations": [ + { + "Name": "Tarini Guttula", + "Position": "Head of public relations", + "Discord": "Tarini#3832", + "Email": "tarini.19bce7758@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/tarinig/", + "GitHub": "https://github.com/tatiniG/", + "Description": "when day dreams become reality" + } + ], + "Track lead": [ + { + "Name": "Dhruv Jha", + "Position": "Track lead", + "Discord": "fullmeteor172#9084", + "Email": "dhruv.21bce7902@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/dhruv-jha-2002/", + "GitHub": "https://github.com/fullmeteor172", + "Description": "Not lazy, just on power saving mode ;-;" + } + ], + "Hr lead": [ + { + "Name": "Angel Maria Stanley", + "Position": "HR Lead", + "Discord": "BlacDarc#9677", + "Email": "maria.21bce7363@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/angel-stanly-218a0893/", + "GitHub": "https://github.com/Maiden23", + "Description": "I dont know , and who cares , nobody is gonna read this anyways XD." + } + ] + }, + "Event Department": { + "Event lead": [ + { + "Name": "T. Chethan", + "Position": "Event lead", + "Discord": "Chethan#4848", + "Email": "tirpati.19bce7427@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/chethan-tirupati-523251194", + "GitHub": "https://github.com/chethantirupati", + "Description": "" + }, + { + "Name": "M V S S Maruti Kameshwar", + "Position": "Event lead", + "Discord": "maruti kameshawar#5033", + "Email": "maruti.19bce7243@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/maruti-kameshwar-6b8846215/", + "GitHub": "https://github.com/marutikameshwar", + "Description": "" + } + ], + "Social media lead": [ + { + "Name": "Ch.Sabareesh Reddy", + "Position": "Social Media Lead", + "Discord": "Sabareesh Reddy#1907", + "Email": "sabareesh.19bce7210@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/sabareesh-reddy-chowkacherla-6834a6196/", + "GitHub": "https://github.com/Sabareesh000", + "Description": "" + } + ], + "Organizer": [ + { + "Name": "Rahul Alokkan", + "Position": "Organizer", + "Discord": "RA7#0512", + "Email": "rahul.20bcn7006@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/rahul-alokkan-16384b196/", + "GitHub": "https://github.com/Rahul-Alokkan", + "Description": "Tech Entusiast " + }, + { + "Name": "Nishita Singh", + "Position": "Organizer", + "Discord": "Nishita Singh#8630", + "Email": "nishita.21bce8684@vitapstudent.ac.in", + "LinkedIn": "", + "GitHub": "", + "Description": "" + } + ] + }, + "Tech Department": { + "Technical lead": [ + { + "Name": "N. Krishna Raj", + "Position": "Technical Lead", + "Discord": "KodeReaper#7759", + "Email": "krishna.19bce7357@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/n-krishna-raj/", + "GitHub": "https://github.com/kode-logger", + "Description": "Octocats never die, they only Evolve." + }, + { + "Name": "Sai Pranay", + "Position": "Technical Lead", + "Discord": "sai pranay#9087", + "Email": "pranay.20bci7061@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/saipranay47/", + "GitHub": "https://github.com/saipranay47", + "Description": "I build things for the web" + }, + { + "Name": "GVS Sai Madhav", + "Position": "Technical Lead", + "Discord": "DarthVader#3395", + "Email": "surya.19bcn7228@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/gvssmadhav", + "GitHub": "https://github.com/gvssaimadhav", + "Description": "Soon, We Are Going to Live in the Era of AI." + } + ], + "Developer": [ + { + "Name": "Mahesh Dasika", + "Position": "Developer", + "Discord": "Tech-Dynamo#5367", + "Email": "mahesh.20bci7075@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/mahesh-d-178b681b8/", + "GitHub": "https://github.com/mahesh-11102", + "Description": "Tech and Auto enthusiast" + }, + { + "Name": "Aryan Mohanty", + "Position": "Developer", + "Discord": "Aryan Mohanty#1066", + "Email": "aryan.21bce8377@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/aryan-mohanty-230160221/", + "GitHub": "https://GitHub.com/AryanVIT", + "Description": "Better never means better for everyone it always means worse for some" + }, + { + "Name": "Ashutosh Patel", + "Position": "Developer", + "Discord": "Ashutosh#8081", + "Email": "ashutosh.20bce7053@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/ashutosh-patel-a828a4221/", + "GitHub": "https://github.com/ashu168", + "Description": "Don't complain just work harder" + }, + { + "Name": "A. Loukya", + "Position": "Developer", + "Discord": "loukya#7114", + "Email": "loukya.21bce7404@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/adepu-loukya-67a345221/", + "GitHub": "https://github.com/A-Loukya", + "Description": "" + } + ] + }, + "Design Team": { + "Head of marketing": [ + { + "Name": "P. Kaarthik Sai", + "Position": "Head of marketing", + "Discord": "CYRUS PLAGUE#3634", + "Email": "Kaarthik.19bcd7142@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/kaarthik-patibandla-30017219a/", + "GitHub": "https://github.com/kaarthik01", + "Description": "That which does not kill us makes us stronger" + } + ], + "Chief editor": [ + { + "Name": "Chirag Gupta", + "Position": "Chief Editor", + "Discord": "chiragg#1721", + "Email": "chirag.20bce7453@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/chirag-gupta-8a16161ba", + "GitHub": "https://github.com/chiragg06", + "Description": "I overthink the niche." + } + ], + "Head of videography": [ + { + "Name": "M Abhiram Kalyan", + "Position": "Head of videography", + "Discord": "Abhiram#3959", + "Email": "kalyan.19bcd7118@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/abhiram-kalyan-883445190/", + "GitHub": "https://github.com/abhiram-kalyan", + "Description": "" + } + ], + "Documentation specialist": [ + { + "Name": "Sai Shaket Kalivarapu", + "Position": "Documentation Specialist", + "Discord": "Fushiguro#6451", + "Email": "shaket.19bce7547@vitap.ac.in", + "LinkedIn": "https://www.linkedin.com/in/sai-shaket-kalivarapu-51327618a/", + "GitHub": "https://github.com/KilluaZ06", + "Description": "I try to be the fun one" + } + ], + "Designer": [ + { + "Name": "Praseeda kallakuri", + "Position": "Designer", + "Discord": "praseeda kallakuri#8374", + "Email": "praseedha.21bce8649@vitapstudent.ac.in", + "LinkedIn": "https://www.linkedin.com/in/praseeda-kallakuri-970334221", + "GitHub": "https://github.com/praseedakallakuri", + "Description": "creative soul!!" + } + ] + }, + "Year": 2021 } From 8f6206b9cc57673eb4c3c39257d9e3a37c626dc3 Mon Sep 17 00:00:00 2001 From: vijay Date: Sun, 2 Jan 2022 19:27:31 +0530 Subject: [PATCH 3/9] Updated .env.example --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 6019fbe..d43f78b 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -DATABASE_URL=postgres://osc@localhost:5432/oschub +DATABASE_URL=postgres://YourUserName:YourPassword@localHost:5432/YourDatabaseName; API_KEY=top_secret_key MONGO_DB_CON=mongodb://mongodb0.example.com:27017 WEBHOOK_URL=https://discord.com/api/webhooks/ \ No newline at end of file From ec2c50bb03bdbaf60c44f11edf897c05ee9fe740 Mon Sep 17 00:00:00 2001 From: boomer Date: Wed, 2 Feb 2022 15:10:10 +0530 Subject: [PATCH 4/9] Added projects route --- .gitignore | 1 + src/routes/__init__.py | 3 +- src/routes/projects/projects.py | 68 +++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 src/routes/projects/projects.py diff --git a/.gitignore b/.gitignore index f076304..00a6280 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ env \__pycache__ venv/ +ven/ temp \ No newline at end of file diff --git a/src/routes/__init__.py b/src/routes/__init__.py index 5f4480a..8c48a95 100644 --- a/src/routes/__init__.py +++ b/src/routes/__init__.py @@ -1,11 +1,12 @@ from flask import Blueprint from src.routes.events import event from src.routes.eb_details import eb +from src.routes.projects import projects api_blueprint = Blueprint("API", __name__, url_prefix="/api/v1/") api_blueprint.register_blueprint(event.event_bp) api_blueprint.register_blueprint(eb.eb_bp) - +api_blueprint.register_blueprint(projects.projects) @api_blueprint.route("/", methods=["GET"]) def get_data(): diff --git a/src/routes/projects/projects.py b/src/routes/projects/projects.py new file mode 100644 index 0000000..6a0cc6c --- /dev/null +++ b/src/routes/projects/projects.py @@ -0,0 +1,68 @@ +from flask import Blueprint , jsonify +from dotenv import load_dotenv +import requests +from html.parser import HTMLParser + + +load_dotenv() +projects = Blueprint("projects", __name__, url_prefix="/projects") + + +class ParseOSCrepo(HTMLParser): #The HTML parser for scraping img link from + token: str = None + + def handle_starttag(self, tag: str, attrs: str): + if self.token: + return + + if tag != "meta": + return + + token = None + for (index, (k, v)) in enumerate(attrs): + if k == "content": + token = v + + if all([k == "property", v == "og:image"]): + if token: + self.token = token + return + for (inner_index, (nk, nv)) in enumerate(attrs, start=index): + if nk == "content": + self.token = nv + return + +def imglink(github_repolink): #Web scraping the image link from github + req = requests.get(f'{github_repolink}') + parseObj = ParseOSCrepo() + parseObj.feed(req.text) + return parseObj.token + + +@projects.route("/", methods=["GET"]) +def project_info(): + results = [] + req = requests.get("https://api.github.com/users/Open-Source-Community-VIT-AP/repos") + jsonfile = req.json() + + for i in jsonfile: #Formatting the data + results.append( + { + "stars": i["stargazers_count"], + "Name" : i['name'], + "Description" : i['description'], + "Image" : imglink(i['html_url']), + "Repository_link": i['html_url'], + "ssh" : i["ssh_url"] + } + ) + + for i in range(len(results)): #Sorting according to stars + for j in range(len(results)-1): + if results[j]['stars'] Date: Wed, 2 Feb 2022 15:25:46 +0530 Subject: [PATCH 5/9] Added to documentation --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d69a707..b682380 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ | 3 | [api/event/\] | https://osc-api.herokuapp.com/api/event/8 | GET data from a particular event (from Event ID). | | 4 | [api/event/latest] | https://osc-api.herokuapp.com/api/event/latest | GET data of the latest OSC event. | | 5 | [api/event/announcement] | https://osc-api.herokuapp.com/api/event/announcement?api_key= | POST to this endpoint to send a discord announcement | +| 6 | [api/projects/] | https://osc-api.herokuapp.com/api/projects | GET all public repos from the github organisation. | ## Contributing From f275b7ea776861e359c64450c07f3d0e05729525 Mon Sep 17 00:00:00 2001 From: boomer Date: Wed, 2 Feb 2022 15:30:25 +0530 Subject: [PATCH 6/9] Limited the results to the 10 most popular repos --- src/routes/projects/projects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/projects/projects.py b/src/routes/projects/projects.py index 6a0cc6c..607bfc0 100644 --- a/src/routes/projects/projects.py +++ b/src/routes/projects/projects.py @@ -65,4 +65,4 @@ def project_info(): for i in results: #Removing stars from the results del i['stars'] - return jsonify(results) + return jsonify(results[0:10]) From 6bf04d959e8eb5aa79e13964843db4ba6c361868 Mon Sep 17 00:00:00 2001 From: vijay Date: Wed, 2 Feb 2022 16:31:46 +0530 Subject: [PATCH 7/9] Formatted with black --- src/routes/__init__.py | 3 +- src/routes/projects/projects.py | 67 ++++++++++++++++----------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/routes/__init__.py b/src/routes/__init__.py index 8c48a95..4e5a8f8 100644 --- a/src/routes/__init__.py +++ b/src/routes/__init__.py @@ -6,7 +6,8 @@ api_blueprint = Blueprint("API", __name__, url_prefix="/api/v1/") api_blueprint.register_blueprint(event.event_bp) api_blueprint.register_blueprint(eb.eb_bp) -api_blueprint.register_blueprint(projects.projects) +api_blueprint.register_blueprint(projects.projects_bp) + @api_blueprint.route("/", methods=["GET"]) def get_data(): diff --git a/src/routes/projects/projects.py b/src/routes/projects/projects.py index 607bfc0..bcb37cb 100644 --- a/src/routes/projects/projects.py +++ b/src/routes/projects/projects.py @@ -1,68 +1,67 @@ -from flask import Blueprint , jsonify +from flask import Blueprint, jsonify from dotenv import load_dotenv import requests from html.parser import HTMLParser - load_dotenv() -projects = Blueprint("projects", __name__, url_prefix="/projects") +projects_bp = Blueprint("projects_bp", __name__, url_prefix="/projects") -class ParseOSCrepo(HTMLParser): #The HTML parser for scraping img link from +class ParseOSCrepo(HTMLParser): # The HTML parser for scraping img link from token: str = None def handle_starttag(self, tag: str, attrs: str): if self.token: return - if tag != "meta": return - token = None - for (index, (k, v)) in enumerate(attrs): - if k == "content": - token = v - - if all([k == "property", v == "og:image"]): + for (index, (i, j)) in enumerate(attrs): + if i == "content": + token = j + if all([i == "property", j == "og:image"]): if token: self.token = token return - for (inner_index, (nk, nv)) in enumerate(attrs, start=index): - if nk == "content": - self.token = nv + for (inner_index, (ni, nj)) in enumerate(attrs, start=index): + if ni == "content": + self.token = nj return -def imglink(github_repolink): #Web scraping the image link from github - req = requests.get(f'{github_repolink}') + +def imglink(github_repolink): # Web scraping the image link from github + req = requests.get(f"{github_repolink}") parseObj = ParseOSCrepo() parseObj.feed(req.text) return parseObj.token -@projects.route("/", methods=["GET"]) +@projects_bp.route("/", methods=["GET"]) def project_info(): results = [] - req = requests.get("https://api.github.com/users/Open-Source-Community-VIT-AP/repos") - jsonfile = req.json() + req = requests.get( + "https://api.github.com/users/Open-Source-Community-VIT-AP/repos" + ) + jsonfile = req.json() - for i in jsonfile: #Formatting the data + for i in jsonfile: # Formatting the data results.append( { - "stars": i["stargazers_count"], - "Name" : i['name'], - "Description" : i['description'], - "Image" : imglink(i['html_url']), - "Repository_link": i['html_url'], - "ssh" : i["ssh_url"] + "Stars": i["stargazers_count"], + "Name": i["name"], + "Description": i["description"], + "Image": imglink(i["html_url"]), + "Repository_link": i["html_url"], + "SSH": i["ssh_url"], } ) - - for i in range(len(results)): #Sorting according to stars - for j in range(len(results)-1): - if results[j]['stars'] Date: Wed, 2 Feb 2022 16:47:51 +0530 Subject: [PATCH 8/9] Moved helper function to utils dir, disabled sort. --- src/routes/projects/projects.py | 35 +++++++-------------------------- src/utils/project_img.py | 23 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 src/utils/project_img.py diff --git a/src/routes/projects/projects.py b/src/routes/projects/projects.py index bcb37cb..e91751d 100644 --- a/src/routes/projects/projects.py +++ b/src/routes/projects/projects.py @@ -1,35 +1,13 @@ -from flask import Blueprint, jsonify +from flask import Blueprint, current_app, jsonify from dotenv import load_dotenv +from src.utils.project_img import ParseOSCrepo import requests -from html.parser import HTMLParser load_dotenv() projects_bp = Blueprint("projects_bp", __name__, url_prefix="/projects") -class ParseOSCrepo(HTMLParser): # The HTML parser for scraping img link from - token: str = None - - def handle_starttag(self, tag: str, attrs: str): - if self.token: - return - if tag != "meta": - return - token = None - for (index, (i, j)) in enumerate(attrs): - if i == "content": - token = j - if all([i == "property", j == "og:image"]): - if token: - self.token = token - return - for (inner_index, (ni, nj)) in enumerate(attrs, start=index): - if ni == "content": - self.token = nj - return - - -def imglink(github_repolink): # Web scraping the image link from github +def img_link(github_repolink): # Web scraping the image link from github req = requests.get(f"{github_repolink}") parseObj = ParseOSCrepo() parseObj.feed(req.text) @@ -38,6 +16,7 @@ def imglink(github_repolink): # Web scraping the image link from github @projects_bp.route("/", methods=["GET"]) def project_info(): + current_app.config["JSON_SORT_KEYS"] = False results = [] req = requests.get( "https://api.github.com/users/Open-Source-Community-VIT-AP/repos" @@ -50,7 +29,7 @@ def project_info(): "Stars": i["stargazers_count"], "Name": i["name"], "Description": i["description"], - "Image": imglink(i["html_url"]), + "Image": img_link(i["html_url"]), "Repository_link": i["html_url"], "SSH": i["ssh_url"], } @@ -58,10 +37,10 @@ def project_info(): for i in range(len(results)): # Sorting according to stars for j in range(len(results) - 1): - if results[j]["stars"] < results[j + 1]["stars"]: + if results[j]["Stars"] < results[j + 1]["Stars"]: results[j], results[j + 1] = results[j + 1], results[j] for i in results: # Removing stars from the results - del i["stars"] + del i["Stars"] return jsonify(results[0:10]) diff --git a/src/utils/project_img.py b/src/utils/project_img.py new file mode 100644 index 0000000..d102482 --- /dev/null +++ b/src/utils/project_img.py @@ -0,0 +1,23 @@ +from html.parser import HTMLParser + +# HTML parser for scraping image link from GitHub repository +class ParseOSCrepo(HTMLParser): + token: str = None + + def handle_starttag(self, tag: str, attrs: str): + if self.token: + return + if tag != "meta": + return + token = None + for (index, (i, j)) in enumerate(attrs): + if i == "content": + token = j + if all([i == "property", j == "og:image"]): + if token: + self.token = token + return + for (inner_index, (ni, nj)) in enumerate(attrs, start=index): + if ni == "content": + self.token = nj + return From d1132225913b4cc4bc09f044d4b5a676620bf339 Mon Sep 17 00:00:00 2001 From: Avula Chandra Kiran Reddy Date: Sat, 13 May 2023 22:46:33 +0530 Subject: [PATCH 9/9] Replaced psycopg2 with binary package (psycopg2-binary) --- requirements.txt | Bin 1488 -> 753 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/requirements.txt b/requirements.txt index 982e5fbb201068b394d330e3d057d9fa44879563..26041b1a2d26be2c7e8e558f7ea0c6fb42445f3e 100644 GIT binary patch literal 753 zcmY*X%Z}7A5WJ5xpOPq#VRq)=6N1A^Tv#N|p2U+hV*nvwzfVS6ZjNWtt z;93BzPIqM4Q@#Yc1dL0^erSptIUN?!xt3?(%fxPAu~H*60VKhqX9#^4&icB;tE`Tz zK{J@ayzONzcNFM##!tvQHfNEHgcdyJBJpH#b_o*;r^TDT&|AED3n1i%|Mr8UYCGH< kEV6C$__=&K9=@9JSj{|aae;8rA%EW|VPDDT-<^ej1CUVH@Bjb+ literal 1488 zcmaKsOK;O~5XAS4#7A)zJB79fP6!T2TqqLfJe*(}KZqUF^uq(c+4Vm*m5MCq;a$(p z%#Qu%_sS}3?Yj*eoxS5&+LhgM=JwiNS=4*F_SW$4;5|9@f^#wUG}L==ZtX4Ca__nG z`h?Tl8H9~xOscH5lKvCFHS_v~-hr-u>{-y0JG(ShoR8FnP*9t5TEle3w1-(WhueDO zyaD;>Om?sdgvE%WK6xPh8@yThl#=cY1ug$-ccQWm-2bv7yDrM_SJT5ED{iUlHMI^T6d$Nt}Mh}|J})+yOorUPffgIreG?A~{{5jw?8SfN17YUi@&Q?ukl?);~Y zl)4O^?Wp0`g<1X#Zy*)nReHKY*%3Y3$>XzX?nzG>RM$^@jkmzGxq|mhN{svqlz2|2 z$^gIG^CAW*i?P$eH&LP?!{d2gm7(AmJxa#@KN|~=lwzHMeqslQF{w*e7}Le=#&iA+ gP0EzsASdv{qdCUeQ#ZYDZ!YLhDDF7Yh9<>-0c)w$%>V!Z