ozgur / python-linkedin

Python interface to the LinkedIn API
http://ozgur.github.com/python-linkedin/
MIT License
894 stars 392 forks source link

Member Updates #35

Closed felipemarin closed 10 years ago

felipemarin commented 10 years ago

Hi I created this function for LinkedinApplication object similar to Javascript API's Member Updates, based on get_network_updates(). Hope you find it useful

def get_member_updates(self, types, linkedin_id, self_scope=True, params=None, headers=None):
    url = '%s/%s/network/updates' % (ENDPOINTS.PEOPLE, linkedin_id)
    if not params:
        params = {}

    if types:
        params.update({'type': types})

    if self_scope is True:
        params.update({'scope': 'self'})

    try:
        response = self.make_request('GET', url, params=params, headers=headers)
        response = response.json()
    except requests.ConnectionError as error:
        raise LinkedInHTTPError(error.message)
    else:
        if not self.request_succeeded(response):
            raise LinkedInError(response)
        return response
ozgur commented 10 years ago

Thanks!