-
Notifications
You must be signed in to change notification settings - Fork 0
/
indeed_jobs.py
38 lines (33 loc) · 966 Bytes
/
indeed_jobs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from indeed import IndeedClient
import pymysql
from database import addToDatabase
client = IndeedClient(publisher = ***************)
parameters = {'q' : "python developer",
'l' : "India",
'sort' : "date",
'fromage' : "5",
'limit' : "25",
'filter' : "1",
'userip' : "192.186.176.550:60409",
'useragent' : "Mozilla/5.0"
}
def get_offers(params):
search_results = client.search(**search_params)
for elm in search_results['results']:
offer = (elm['jobtitle'],
elm['formattedLocation'],
elm['snippet'],
elm['url'],
elm['indeedApply'],
elm['jobkey'],
elm['date'])
addToDatabase(offer)
def searchAllCities():
current_city = 0
with open('cities', 'r', encoding='utf8') as myfile:
locations = myfile.read().split('\n')
city_number = len(locations)
while current_city < city_number:
params['l'] = locations[current_city]
get_offers(params)
current_city += 1