Skip to content

Commit 4f1cc9f

Browse files
authored
Add files via upload
1 parent 0e40d70 commit 4f1cc9f

File tree

3 files changed

+160
-0
lines changed

3 files changed

+160
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
import xlwt
3+
import os
4+
5+
style_head = xlwt.easyxf('font: bold 1,height 300;')
6+
style_body = xlwt.easyxf('font: height 260;')
7+
8+
def write_header(sheet):
9+
sheet.write(0, 0, 'Title', style_head)
10+
sheet.write(0, 1, 'Company', style_head)
11+
sheet.write(0, 2, 'Location', style_head)
12+
sheet.write(0, 3, 'Duration', style_head)
13+
sheet.write(0, 4, 'Stipend', style_head)
14+
sheet.write(0, 5, 'Apply By', style_head)
15+
sheet.write(0, 6, 'Applicants', style_head)
16+
sheet.write(0, 7, 'Skills Required', style_head)
17+
sheet.write(0, 8, 'Perks', style_head)
18+
sheet.write(0, 9, 'Number of Openings', style_head)
19+
sheet.write(0, 10, 'Link', style_head)
20+
21+
def write_body(params,sheet):
22+
params = list(params.values())
23+
max_val = [0]*len(params)
24+
for excel_row in range(1,len(params[0])+1):
25+
for excel_col in range(len(params)):
26+
sheet.write(excel_row,excel_col,params[excel_col][excel_row-1],style_body)
27+
col_width = len(str(params[excel_col][excel_row-1])) + 3
28+
max_val[excel_col] = col_width if 160 > col_width > max_val[excel_col] else max_val[excel_col]
29+
sheet.col(excel_col).width = 256 * max_val[excel_col]
30+
31+
def save_and_export(flag,workbook):
32+
33+
err = True
34+
name = ''
35+
while err == True:
36+
err = False
37+
choice = int(input("\n1: Add New Sheet\n2: Save and Open the file in Excel\n3: Save file\n4: Discard file and Exit\n"))
38+
try:
39+
if(choice == 2):
40+
name = input("Enter the name of the file\n")
41+
workbook.save('./'+name+'.xls')
42+
os.system("start EXCEL.EXE {name}.xls".format(name = name))
43+
exit()
44+
elif(choice == 3):
45+
name = input("Enter the name of the file\n")
46+
workbook.save('./'+name+'.xls')
47+
exit()
48+
elif(choice == 1):
49+
pass
50+
elif(choice == 4):
51+
exit()
52+
else:
53+
raise ValueError
54+
except PermissionError:
55+
print("Don't have appropriate permissions to perform the operation. "+
56+
"Try changing the name of the file to something unique or run terminal as admin...Choose again")
57+
err = True
58+
except ValueError:
59+
print("Invalid Input, Loading choices again.............")
60+
err = True
61+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
def select_categories(category_list):
2+
final_params = []
3+
for category in category_list:
4+
category = category.strip()
5+
if '/' in list(category):
6+
category = category.replace('/','%2F')
7+
final_params.append(category.split(' ')[0])
8+
else:
9+
category = category.replace(' ','%20')
10+
final_params.append(category)
11+
12+
final_params = ','.join(final_params)
13+
final_params+='-internship'
14+
return final_params
15+
16+
def select_locations(location_list):
17+
final_params = []
18+
for location in location_list:
19+
location = location.strip()
20+
location = location.replace(' ','%20')
21+
final_params.append(location)
22+
final_params = ','.join(final_params)
23+
final_params ='-in-'+final_params
24+
25+
return final_params
26+
27+
def select_dates(start,duration):
28+
import datetime
29+
30+
if len(start) != 0:
31+
year,month,day = map(int,start.split("-"))
32+
start_date = '/start_date-'+str(datetime.date(year, month, day)).replace('-','')
33+
else:
34+
start_date= ''
35+
36+
if len(duration) != 0:
37+
duration = '/duration-'+duration
38+
else:
39+
duration = ''
40+
return(start_date,duration)
41+
42+
if __name__ == "__main__":
43+
print("Run main.py file")
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import Functions.GetParameters as gp
2+
import datetime
3+
4+
def get_URL_params():
5+
final_params=''
6+
Error = True
7+
while Error:
8+
try:
9+
print('--------------------------------------------------------------------')
10+
other_params=list(map(int,input("Include Work From home?\nInclude Part-time?\nInternships for women?\nInternships with job offer?\n(Represent your choice with 1-True or 0-False separated by commas such as 1,0,0,1)\n\n").split(',')))
11+
if max(other_params) > 1 or min(other_params) < 0:
12+
raise ValueError
13+
14+
category_list = list(map(str,input("Enter different categories separated by commas* (Required)\n").split(','))) #Example -> Web Development,Accounts,Acting
15+
location_list = list(map(str,input("Enter different locations separated by commas* (Required)\n").split(','))) #Example -> Mumbai,Delhi
16+
17+
start = input('Enter start date in format (yyyy-mm-dd) or leave empty for current date\n') #Example -> 2020-9-3
18+
if(len(start)!=0):
19+
datetime.datetime.strptime(start,'%Y-%m-%d')
20+
21+
duration = input("Enter maximum duration or leave empty for any duration\n")
22+
print('--------------------------------------------------------------------')
23+
Error = False
24+
except (ValueError,IndexError,TypeError):
25+
print("Error in input values, loading options again")
26+
Error = True
27+
28+
if other_params[2] == 1:
29+
final_params += '/internships-for-women/'
30+
else:
31+
final_params += '/internships/'
32+
33+
if other_params[0] == 1:
34+
final_params+= 'work-from-home-'
35+
36+
start_date,max_duration = gp.select_dates(start,duration)
37+
38+
final_params += gp.select_categories(category_list)
39+
final_params += gp.select_locations(location_list)
40+
final_params += max_duration
41+
final_params += start_date
42+
43+
if other_params[1] == 1:
44+
final_params += '/part_time-true'
45+
46+
if other_params[3] == 1:
47+
final_params += '/ppo-true'
48+
49+
if other_params[0] == 1 or other_params[1] == 1:
50+
final_params = final_params.replace('-internship','-jobs')
51+
52+
return final_params
53+
54+
if __name__ == "__main__":
55+
print("Run main.py file")
56+

0 commit comments

Comments
 (0)