Permalink
Browse files

Merge pull request #1 from remik/master

job_details fixes
  • Loading branch information...
2 parents 94f5a93 + 5dbbf96 commit 934f20531cc44af35d67c57ba0650fc4207bd7f7 @fission6 committed Oct 19, 2011
Showing with 13 additions and 4 deletions.
  1. +4 −0 README
  2. +9 −4 indeed/indeed.py
View
4 README
@@ -13,3 +13,7 @@ json_results = api.search('job keywords')
print json_results
+json_details = api.job_details([json_results['results'][0]['jobkey']])
+
+print json_details
+
View
@@ -1,6 +1,7 @@
import urllib2
import json
from urllib import urlencode
+import types
class IndeedApi(object):
@@ -10,17 +11,20 @@ def __init__(self, publisher_id, **kwargs):
self.publisher_id = publisher_id
self.base_url = 'http://api.indeed.com/ads/'
- def search(self, query=None, location='US'):
-
+ def search(self, query=None, location='US', country_code='us'):
+
action = 'apisearch'
query_params = {
'q' : query,
'l' : location,
+ 'co': country_code,
'format' : 'json',
'v' : '2',
'publisher' : self.publisher_id
}
-
+
+ query_params = dict([(k, v.encode('utf-8') if type(v) is types.UnicodeType else v) \
+ for (k, v) in query_params.items()])
query_string = urlencode(query_params)
service_req = '{0}{1}?{2}'.format(self.base_url, action, query_string)
@@ -34,8 +38,9 @@ def job_details(self, job_keys):
action = 'apigetjobs'
query_params = {
- 'q' : query,
+ 'jobkeys' : ','.join(job_keys),
'format' : 'json',
+ 'v' : '2',
'publisher' : self.publisher_id
}

0 comments on commit 934f205

Please sign in to comment.