1

I'm using tornado web server and to integrate linkedin in my application I'm using the LinkedinMixin class that I add to the framework from an unofficial code in github. All is working perfectly, but I would like to be able to use the share api

POST http://api.linkedin.com/v1/people/~/shares

The linkedin API is in XML, this is the reason why it's sometimes difficult to integrate it in tornado

https://developer.linkedin.com/documents/api-requests-json

I found this article which tell me to send

{ "contentType":"linkedin-html", "body":"My Fancy Update" }

to post an update but it sends me a HTTP 401: Unauthorized fetching http://api.linkedin.com/v1/people/~/shares?...

I would like to know if someone knows another version of linkedinMixin that this one : https://github.com/facebook/tornado/pull/236/files

And if someone could give me a complete example of share API using JSON

Thanks,

kschaeffler
  • 4,083
  • 7
  • 33
  • 41

1 Answers1

0

I should probably point out that I have no experience with the LinkedIn API or the Tornado webserver. I have done a lot of work with OAuth, JSON and XML though.

Judging by the class you mentioned, the

def linkedin_request(self, path, callback, access_token=None, post_args=None, **args):

does exactly what you want. No need to bother about requesting JSON, etc. It does it for you.

I haven't really analyzed the classes, but I'd assume that your callback would look something like :

import json
def callback(data):
    # If data is a JSON string, parse it. (remove this if data is a dict)
    data = json.loads(data)

    # Do something with the data
    print data

def makeRequest():
    something.linkedin_request("/v1/people/~/shares", callback)

I hope that this pointed you in the right direction :-)

Tom van der Woerdt
  • 29,532
  • 7
  • 72
  • 105