python-blekko 0.1.1

MIT/X Consortium Lic...


python-blekko 0.1.1

blekko is a Python module that provides simple bindings to the Blekko API. To use the API, contact Blekko for an API key.

This module currently only supports search queries and page statistics. The API also provides tools for manipulating slashtags, but this library doesn't support that yet.

The library is internally rate-limited to one query per second in accordance with Blekko's guidelines.

Searching

To use the API, first create a Blekko object using your "source" or "auth" API key:

import blekko
api = blekko.Blekko(source='my_api_key')


Then, to perform searches, use the query method. Its arguments are the search terms (as a string) and, optionally, the page number:

results = api.query('peach cobbler')

The returned object is a sequence containing Result objects, which themselves have a number of useful fields:

for result in results:
 print result.url_title
 print result.url
 print result.snippet

Errors in communicating with the server are raised as BlekkoError exceptions, so you'll want to handle these exceptions when making calls to the API.

An Example

Putting it all together, here's a short script that gets a single link for search terms on the command line:

import blekko
import sys

_api = blekko.Blekko(source='my_api_key')

def get_link(terms):
 try:
 res = _api.query(terms + ' /ps=1')
 except blekko.BlekkoError as exc:
 print >>sys.stderr, str(exc)
 return None
 if len(res):
 return res[0].url

if __name__ == '__main__':
 link = get_link(' '.join(sys.argv[1:]))
 if link:
 print(link)
 else:
 sys.exit(1)


Page Statistics

Blekko provides an API for getting SEO-related statistics for a URL. Use the pagestats method, which takes a URL as its only parameter, to get a dictionary containing information about a page:

>>> api.pagestats('http://python.org/')
{u'cached': True, u'ip': u'82.94.164.162', u'host_rank': 3835.107267,
u'host_inlinks': 467267, u'adsense': None, u'dup': True,
u'rss': u'http://www.python.org/channews.rdf'}



Product's homepage

Requirements:

· Python

Download and use it now: python-blekko 0.1.1 free download

Add a review

Tell us your experience with python-blekko 0.1.1

Related programsOur Recommendations

jarn.xmpp.collaboration 0.1 Beta 2

jarn.xmpp.collaboration is a Plone product that defines a protocol to do real-time collaborative

Download

HTTrack/WebHTTrack 3.45-1

HTTrack is a free (GPL, libre/free software) and easy-to-use offline browser utility.It allows you

Download

Debug::Simple 0.10

Debug::Simple is a Perl module which provides a very simple way to provide debug/verbose/warning

Download

Geomajas 1.10.0

Geomajas is the extensible and open source web mapping framework, enabling integrated GIS solutions

Download

execline 1.2.0

execline projct consists of a (non-interactive) scripting language, like sh ; but its syntax is

Download

New Tab JumpStart 0.5 Alpha 5.4.3

When you open a new tab get immediate access to your most frequently used sites, bookmarks, closed

Download

NetBeans IDE 7.4

NetBeans IDE is a free and full-featured Integrated Development Environment (IDE) for

Download

PLSTKGLSSGRN 0.05

PLSTKGLSSGRN is a green version of the PLSTKGLSS theme.How to install?· Right click on your

Download

Monotone::AutomateStdio 1.02

Monotone::AutomateStdio is a Perl module that gives a Perl developer access to Monotone's automate

Download

LiveJournal Addons 9.4

LiveJournal Addons is an extension which add some facilities to LiveJournal.Add some facilities to

Download


Thumbnail of python-blekko 0.1.1

Rating:

5 stars

Price: X Consortium Lic...

Publisher/Developer: Adrian Sampson

Release Date: Jun 24, 2012

View Program Details

Top Downloadslast week