Exemple #1
0
class Player(Item):
    id = IntegerField('//player/@id')
    first_name = StringField('//player/firstname')
    retrieved = DateTimeField('//player/@retrieved', '%Y-%m-%dT%H:%M:%SZ')
    comment = StringField('//player/comment')
    comment_cdata = StringField('//player/comment_cdata')

    data_not_found = StringField('//data/no/found')

    @func_field(pass_item=True)
    def calculated(item, sel):
        if not hasattr(item, 'count'):
            item.count = 1
        else:
            item.count += 1
        return sel.select('//height').text() + '-zoo-' + str(item.count)

    calculated2 = FuncField(calculated_func2, pass_item=True)
Exemple #2
0
class GameItem(Item):
    class Meta:
        find_query = '//games/game'

    name = StringField('@name')
Exemple #3
0
    class PlanetItem(Item):
        class Meta:
            find_query = '$..planets[*]'
            selector_type = 'json'

        name = StringField('name')
Exemple #4
0
class GameItem(Item):
    class Meta:
        find_query = '//games/game'

    name = StringField('@name')
    names = StringField('@name', multiple=True)
Exemple #5
0
 class ChildItem(BaseItem):
     name = StringField('lastname')
Exemple #6
0
        class BaseItem(Item):
            class Meta:
                find_query = '//player'

            name = StringField('firstname')
            age = IntegerField('age')
Exemple #7
0
 class GameItem(Item):
     names = StringField('//game/@name', multiple=True)