-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add get_orgs script to get list of orgs in the terminal itself
- Loading branch information
1 parent
a5b1746
commit 56fa858
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |