Skip to content

Commit

Permalink
Add get_orgs script to get list of orgs in the terminal itself
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyansh23 committed Mar 3, 2019
1 parent a5b1746 commit 56fa858
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions get_orgs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python

import requests
import datetime
from bs4 import BeautifulSoup

current_date = datetime.datetime.now()
current_year = current_date.year

query_year = raw_input("Enter a year from 2016 to " + str(current_year) + "\n")

# typecase query_year from string to integer
query_year = int(query_year)

#Validate input year
if(query_year < current_year and query_year >= 2016):
print("\nWait a sec...\n")
else:
print("Oops! Invalid year selected. Try Again")
exit()

url = "https://summerofcode.withgoogle.com/archive/" + str(query_year) + "/organizations/"

response = requests.get(url)
html = response.content
soup = BeautifulSoup(html,"html.parser")

orgs = soup.find_all("h4", class_="organization-card__name font-black-54")

print("Here you go...")
print("=============================================================\n")

#Print the names or the organisations
for org in orgs:
name = org.text
print(name)

0 comments on commit 56fa858

Please sign in to comment.