Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow field selector strings, use new people-search api.

  • Loading branch information...
commit 207b6f3dc8641bb116ea5216a5b251dfb9b6d247 1 parent fe78219
Jason Sundram jsundram authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 liclient/__init__.py
12 liclient/__init__.py
View
@@ -165,7 +165,7 @@ def set_status_update(self, access_token, bd):
resp, content = client.request(url, method='PUT', body=xml_request)
return content
- def search(self, access_token, data):
+ def search(self, access_token, data, field_selector_string=None):
"""
Use the LinkedIn Search API to find users. The criteria for your search
should be passed as the 2nd positional argument as a dictionary of key-
@@ -173,9 +173,10 @@ def search(self, access_token, data):
of arguments will be done for you (i.e. lists of keywords will be joined
with "+")
"""
- srch = LinkedInSearchAPI(data, access_token)
+ srch = LinkedInSearchAPI(data, access_token, field_selector_string)
client = oauth.Client(self.consumer, srch.user_token)
rest, content = client.request(srch.generated_url, method='GET')
+ # print content # useful for debugging...
return LinkedInXMLParser(content).results
def send_message(self, access_token, recipients, subject, body):
@@ -362,8 +363,10 @@ def invitation_factory(self, recipient, subject, body, **kwargs):
return re.sub('_', '-', etree.tostring(mxml))
class LinkedInSearchAPI(LinkedInAPI):
- def __init__(self, params, access_token):
- self.api_search_url = 'http://api.linkedin.com/v1/people/'
+ def __init__(self, params, access_token, field_selector_string=None):
+ self.api_search_url = 'http://api.linkedin.com/v1/people-search'
+ if field_selector_string:
+ self.api_search_url += ':' + field_selector_string
self.routing = {
'keywords': self.keywords,
'name': self.name,
@@ -374,6 +377,7 @@ def __init__(self, params, access_token):
'sort_criteria': self.sort_criteria
}
self.user_token, self.generated_url = self.do_process(access_token, params)
+ print "url:", self.generated_url
def do_process(self, access_token, params):
assert type(params) == type(dict()), 'The passed parameters to the Search API must be a dictionary.'
Please sign in to comment.
Something went wrong with that request. Please try again.