4
4
from requests .packages .urllib3 .exceptions import InsecureRequestWarning
5
5
from flask_session import Session
6
6
import pandas as pd
7
-
7
+ try :
8
+ from googlesearch import search
9
+ except ImportError :
10
+ print ("No module named 'google' found" )
8
11
9
12
deptDict = {
10
- 'Aerospace Engineering' : ['https://www.aero.iitb.ac.in/home/people/faculty' ,'https://www.aero.iitb.ac.in/home/people/former-faculty' ],
11
- 'Biosciences and Bioengineering' :['https://www.bio.iitb.ac.in/people/faculty/' ],
12
- 'Chemical Engineering' :['https://www.che.iitb.ac.in/faculty-directory' ],
13
- 'Chemistry' :[],
14
- 'Civil Engineering' :['https://www.civil.iitb.ac.in/faculty' ],
15
- 'Computer Science & Engineering' :[],
16
- 'Earth Sciences' :[],
17
- 'Electrical Engineering' :[],
18
- 'Energy Science and Engineering' :['https://www.me.iitb.ac.in/?q=full-time-faculty' ],
19
- 'Environmental Science and Engineering (ESED)' :['http://www.esed.iitb.ac.in/faculty-directory' ],
20
- 'Humanities & Social Sciences' :[],
21
- 'Mathematics' :[],
22
- 'Mechanical Engineering' :['http://www.esed.iitb.ac.in/faculty-directory' ,'https://www.me.iitb.ac.in/?q=honorary-faculty-members' ],
23
- 'Metallurgical Engineering & Materials Science' :[],
24
- 'Physics' :['https://www.phy.iitb.ac.in/en/faculty' ],
25
- 'All' :
26
- [
13
+ 'Aerospace Engineering' : {
14
+ 'list' : ['https://www.aero.iitb.ac.in/home/people/faculty' ,'https://www.aero.iitb.ac.in/home/people/former-faculty' ],
15
+ 'query' : 'iit Aerospace Engineer faculty name' ,
16
+ },
17
+ 'Biosciences and Bioengineering' :{
18
+ 'list' :['https://www.bio.iitb.ac.in/people/faculty/' ],
19
+ 'query' : 'iit Biosciences and Bioengineer faculty name' ,
20
+ },
21
+ 'Chemical Engineering' :{
22
+ 'list' :['https://www.che.iitb.ac.in/faculty-directory' ],
23
+ 'query' : 'iit Chemical Engineer faculty name' ,
24
+ },
25
+ 'Chemistry' :{
26
+ 'list' :[],
27
+ 'query' : ''
28
+ },
29
+ 'Civil Engineering' :{
30
+ 'list' :['https://www.civil.iitb.ac.in/faculty' ],
31
+ 'query' : ''
32
+ },
33
+ 'Computer Science & Engineering' :{
34
+ 'list' :[],
35
+ 'query' : ''
36
+ },
37
+ 'Earth Sciences' :{
38
+ 'list' :[],
39
+ 'query' : ''
40
+ },
41
+ 'Electrical Engineering' :{
42
+ 'list' :[],
43
+ 'query' : ''
44
+ },
45
+ 'Energy Science and Engineering' :{
46
+ 'list' :['https://www.me.iitb.ac.in/?q=full-time-faculty' ],
47
+ 'query' : ''
48
+ },
49
+ 'Environmental Science and Engineering (ESED)' :{
50
+ 'list' :['http://www.esed.iitb.ac.in/faculty-directory' ],
51
+ 'query' : ''
52
+ },
53
+ 'Humanities & Social Sciences' :{
54
+ 'list' :[],
55
+ 'query' : ''
56
+ },
57
+ 'Mathematics' :{
58
+ 'list' :[],
59
+ 'query' : ''
60
+ },
61
+ 'Mechanical Engineering' :{
62
+ 'list' :['http://www.esed.iitb.ac.in/faculty-directory' ,'https://www.me.iitb.ac.in/?q=honorary-faculty-members' ],
63
+ 'query' : ''
64
+ },
65
+ 'Metallurgical Engineering & Materials Science' :{
66
+ 'list' :[],
67
+ 'query' : ''
68
+ },
69
+ 'Physics' :{
70
+ 'list' :['https://www.phy.iitb.ac.in/en/faculty' ],
71
+ 'query' : ''
72
+ },
73
+ 'All' : {
74
+ 'list' :[
27
75
'https://www.aero.iitb.ac.in/home/people/faculty' ,
28
76
'https://www.aero.iitb.ac.in/home/people/former-faculty' ,
29
77
'https://www.bio.iitb.ac.in/people/faculty/' ,'https://www.che.iitb.ac.in/faculty-directory' ,
30
78
'https://www.civil.iitb.ac.in/faculty' ,'https://www.me.iitb.ac.in/?q=full-time-faculty' ,
31
- 'http://www.esed.iitb.ac.in/faculty-directory' ,'http://www.esed.iitb.ac.in/faculty-directory' ,'https://www.me.iitb.ac.in/?q=honorary-faculty-members'
79
+ 'http://www.esed.iitb.ac.in/faculty-directory' ,'http://www.esed.iitb.ac.in/faculty-directory' ,'https://www.me.iitb.ac.in/?q=honorary-faculty-members' ,
32
80
'https://www.phy.iitb.ac.in/en/faculty' ,'https://en.wikipedia.org/wiki/List_of_IIT_Bombay_people' ,
33
81
'https://www.iitbbs.ac.in/faculty-members.php' ,
34
82
'https://iitpkd.ac.in/faculty-list' ,
35
83
'https://iith.ac.in/people/faculty/' ,
36
84
'http://www.iitkgp.ac.in/department/AE/faculties'
37
-
38
- ]
85
+ ],
86
+ 'query' : 'indian engineering faculty names'
87
+ },
88
+
39
89
}
40
90
41
91
app = Flask (__name__ ,static_folder = './static' )
@@ -52,18 +102,22 @@ def index():
52
102
req = request .form
53
103
# print(req)
54
104
req_table = req .to_dict ()
105
+ print ("==========================================================================================" )
106
+ print (req_table )
107
+ print ("==========================================================================================" )
55
108
56
- if not session .get ("dept_name" ):
57
- # session['dept_name'] = req['dept_name']
58
- session ['dept_name' ] = 'All'
59
109
60
- session ['research_name' ] = req ['research_name' ]
110
+ if not session .get ("dept_name" ) or 'dept_name' in req_table :
111
+ session ['dept_name' ] = req ['dept_name' ]
112
+ # session['dept_name'] = 'All'
113
+
114
+ # session['research_name'] = req['research_name']
61
115
session ['web_prev' ] = False
62
116
63
117
# if 'dept_name' in req_table and 'research_name' in req_table:
64
118
if 'research_name' in req_table :
65
119
# session['dept_name'] = req['dept_name']
66
- session ['dept_name' ] = 'All'
120
+ # session['dept_name'] = 'All'
67
121
68
122
session ['research_name' ] = req ['research_name' ]
69
123
session ['web_prev' ] = False
@@ -113,12 +167,25 @@ def index():
113
167
114
168
115
169
170
+ def getLink (dept_name ):
171
+
172
+
173
+ query = "Chemistry iit faculty name"
174
+
175
+ for j in search (query , tld = "co.in" , num = 10 , stop = 10 , pause = 2 ):
176
+ deptDict [dept_name ]['list' ].append (j )
177
+
178
+
116
179
117
180
def DepartmentHardCoded (dept_name ):
118
181
119
182
data = []
120
183
table_body_arr = []
121
- for link in deptDict [dept_name ]:
184
+
185
+
186
+ getLink (dept_name )
187
+ print (deptDict [dept_name ]['list' ])
188
+ for link in deptDict [dept_name ]['list' ]:
122
189
123
190
faculty = requests .get (link , verify = False )
124
191
# faculty = requests.get('https://www.me.iitb.ac.in/?q=full-time-faculty',verify=False)
@@ -272,5 +339,5 @@ def iitb_Mech():
272
339
273
340
274
341
if __name__ == "__main__" :
275
- app .run (debug = True ,port = "5000" )
342
+ app .run (debug = True ,port = "5000" )
276
343
0 commit comments