[Developers] Errors and results using Python API

David Janes davidjanes at davidjanes.com
Thu Aug 7 23:31:20 UTC 2008


I'm making the following query

name = 'The Godfather'
query = {
    'name~=' : '*%s*' % name,
    'name' : [],
}

using the Python API. Here's the result:

{u'code': u'/api/status/ok',
u'qname': {u'code': u'/api/status/error',
u'messages': [{u'code': u'/api/status/error/mql/result',
u'info': {u'count': 8,
u'result': [{u'name': [u'The Godfather Part II'],
u'type': u'/film/film'},
{u'name': [u'The Godfather Part III'],
u'type': u'/film/film'},
{u'name': [u'The Godfather Saga'],
u'type': u'/film/film'},
{u'name': [u'The Godfather'],
u'type': u'/film/film'},
{u'name': [u'The Black Godfather'],
u'type': u'/film/film'},
{u'name': [u'The Godfather of Green Bay'],
u'type': u'/film/film'},
{u'name': [u'The Godfather/Sandbox'],
u'type': u'/film/film'},
{u'name': [u'The Three Godfathers'],
u'type': u'/film/film'}]},
u'message': u'Unique query may have at most one result. Got 8',
u'path': u'',
u'query': {u'error_inside': u'.',
u'name': [],
u'name~=': u'*The Godfather*',
u'type': u'/film/film'}}]},
u'status': u'200 OK'}

You'll note that this:

(1) has the answers I'm looking for
(2) but says also that it's in error

The Python metaweb code raises an exception of MQLError because of the
error bits.

Regards, etc...

-- 
David Janes


More information about the Developers mailing list