2

I was trying out this Github example.

I get a 403, Access to connections denied error and it returns KeyError: '_total'.

r_network option is present. Has anyone faced this issue?

Also if you look at this Python docs page, the 'requests' library is initializing resource_owner_key, resource_owner_secret apart from the application keys. Not sure how these are getting passed from the 'rauth' library, Was wondering if that was causing this 403 error.

anaximander
  • 7,083
  • 3
  • 44
  • 62
  • this issues seems to be isolated to my account. passing of key / secret of applications created by other users seems to be working. – srinath sastry Nov 14 '12 at 09:38

2 Answers2

1

This might be an issue with permissions set by you in Linkedin. The key error is due to the fact that response received is an error response and does not contain the '_total' key in the dict.

You can try a call to "http://api.linkedin.com/v1/people/~" as this should give your profile details.

Ifthikhan
  • 1,484
  • 10
  • 14
0

Rauth maintainer here.

The linked example is out-of-date and shouldn't be used. Instead, try updating rauth to 0.5.3 and giving this example a try.

If the issue still persists, I think @Ifthikhan might be correct in guessing that it's a permissions problem. In order to check, you can rework the example script to just print the response. Here's a diff:

diff --git a/examples/linkedin-updates-cli.py b/examples/linkedin-updates-cli.py
index 0df692a..d78d20c 100644
--- a/examples/linkedin-updates-cli.py
+++ b/examples/linkedin-updates-cli.py
@@ -25,16 +25,4 @@ r = session.get('people/~/network/updates',
                params={'type': 'SHAR', 'format': 'json'},
                header_auth=True)

-updates = r.json()
-
-for i, update in enumerate(updates['values'], 1):
-    if 'currentShare' not in update['updateContent']['person']:
-        print '{0}. {1}'.format(i, update['updateKey'])
-        continue
-    current_share = update['updateContent']['person']['currentShare']
-    person = current_share['author']['firstName'].encode('utf-8') + ' '
-    person += current_share['author']['lastName'].encode('utf-8')
-    comment = current_share.get('comment', '').encode('utf-8')
-    if not comment:
-        comment = current_share['content']['description'].encode('utf-8')
-    print '{0}. {1} - {2}'.format(i, person, comment)
+print r.json()

Let me know if you're still having difficulties after that.

maxcountryman
  • 1,562
  • 1
  • 24
  • 51