Recent activity
Subscribe to this feed
tom smith replied on March 04, 2009 15:42 to the question "Python API returning 5.0 and errors in test_postrank.py" in PostRank:
I don't quite get this... And I have read the documentation in detail... but I'm a bit dense....
If I do a "feed-based" query, I assume I first get the feed_id, then make a query using that... right? Could I just use the "base site url" to compare a post to its own root?
If I do a thematic query, I pass in (at least) 2 URLs to compare and get a number for each... What does this do, are they compared by content or just by other things (like comments, diggs, etc)... Could I maybe use an "exemplar post" and see how the posts I want to compare fare against it?
For example, will this work?
######################################################
from urlparse import urlsplit
def get_postrank( url ):
# GET THE FEED ID
pr = PostRank( )
r = pr('feed_id', appkey='theotherblog.com', format='json', url=url)
if r == [None, None]:
#feed not found!
return 0.0
feed_id= r[PROCESSED]['feed_id']
#NOW GET THE PAGE'S RANK RELATIVE TO ITS ROOT
p = PostRank( )
items = urlsplit( url)
site_url = "http://" + items[1] # Make a URL that points at the root of the site (assuming the URL isn't)
f = p('postrank', appkey='theotherblog.com', format='json', url=[url, site_url], feed_id=[feed_id])
postrank_num = float( f[1][url]['postrank'] )
return postrank_num
######################################################
tom smith asked a question in PostRank on March 04, 2009 11:57:
Python API returning 5.0 and errors in test_postrank.pyPython API? I think there are a few issues. Firstly, in the test_postrank.py file, the script contains a parameter called "urls" ... which doesn't work, it only accepts "url" as a list.
Secondly, if I send one URL in the "url" param I always get 5.0 back as a postrank, whereas if I prepend the list with any other URL the other value returned starts to vary.
Am I doing something wrong, all I want is to enter a URL and get a number out? I've just noticed that "thematic" only compares URLs... Can I do what I want?
thanks tom@everythingability.com
I
Loading Profile...
