Package intermine :: Module webservice :: Class ResultIterator
[hide private]
[frames] | no frames]

Class ResultIterator

source code

object --+
         |
        ResultIterator

A facade over the internal iterator object

These objects handle the iteration over results in the formats requested by the user. They are responsible for generating an appropriate parser, connecting the parser to the results, and delegating iteration appropriately.

Instance Methods [hide private]
 
__init__(self, root, path, params, rowformat, view, opener, cld=None)
Services are responsible for getting result iterators.
source code
 
__iter__(self)
Returns the internal iterator object.
source code
whatever the rowformat was determined to be
next(self)
Returns the next row, in the appropriate format
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  PARSED_FORMATS = frozenset(['dict', 'list', 'rr'])
  STRING_FORMATS = frozenset(['count', 'csv', 'tsv'])
  JSON_FORMATS = frozenset(['jsonobjects', 'jsonrows'])
  ROW_FORMATS = frozenset(['count', 'csv', 'dict', 'jsonobjects'...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, root, path, params, rowformat, view, opener, cld=None)
(Constructor)

source code 

Constructor

Services are responsible for getting result iterators. You will not need to create one manually.

Parameters:
  • root (string) - The root path (eg: "http://www.flymine.org/query/service")
  • path (string) - The resource path (eg: "/query/results")
  • params (dict) - The query parameters for this request
  • rowformat (string) - One of "rr", "object", "count", "dict", "list", "tsv", "csv", "jsonrows", "jsonobjects"
  • view (list) - The output columns
  • opener (urllib.URLopener) - A url opener (user-agent)
Raises:
  • ValueError - if the row format is incorrect
  • WebserviceError - if the request is unsuccessful
Overrides: object.__init__

Class Variable Details [hide private]

ROW_FORMATS

Value:
frozenset(['count',
           'csv',
           'dict',
           'jsonobjects',
           'jsonrows',
           'list',
           'rr',
           'tsv'])