Exemplo n.º 1
0
import imp
import scraperhelper
imp.reload(scraperhelper)

scraperhelper.setOutputDescription(
        'Recarga de votaciones con error para el período 2014-2018',
        {
            'type': 'Dictionary',
            'elements': [                
                {'type': 'String','name': 'boletin','description': '' },
                {'type': 'String','name': 'fecha','description': '' },
                {'type': 'String','name': 'materia','description': '' },
                {'type': 'String','name': 'articulo','description': '' },
                {'type': 'String','name': 'sesion','description': '' },
                {'type': 'String','name': 'tramite','resultado': '' },
                {'type': 'String','name': 'tipo','description': '' },
                {'type': 'String','name': 'quorum','description': '' },
                {'type': 'String','name': 'resultado','description': '' },
                {'type': 'List','name': 'favor','description': '' },
                {'type': 'List','name': 'contra','description': '' },
                {'type': 'List','name': 'abstencion','description': '' },
                {'type': 'List','name': 'articulo_quinto','description': '' },
                {'type': 'List','name': 'pareos','description': '' },
            ]
        }
)

scraperhelper.setPrintTimeTo(True)
browser = scraperhelper.initBrowser()

# input file
scraperhelper.setOutputDescription(
    'Detalle de todas las sesiones de la cámara de Diputados para el período 2014-2018',
    {
        'type':
        'Dictionary',
        'elements': [{
            'type': 'String',
            'name': 'fecha',
            'description': ''
        }, {
            'type': 'String',
            'name': 'sesion',
            'description': ''
        }, {
            'type': 'String',
            'name': 'estado',
            'description': ''
        }, {
            'type': 'String',
            'name': 'prmid',
            'description': ''
        }, {
            'type':
            'Dictionary',
            'name':
            'ordenes',
            'description':
            '',
            'elements': [{
                'type': 'String',
                'name': 'boletin',
                'description': ''
            }, {
                'type': 'String',
                'name': 'proyecto',
                'description': ''
            }, {
                'type': 'String',
                'name': 'pley_prmid',
                'description': ''
            }, {
                'type': 'String',
                'name': 'origen',
                'description': ''
            }, {
                'type': 'String',
                'name': 'reglamentaria',
                'description': ''
            }, {
                'type': 'String',
                'name': 'informantes',
                'description': ''
            }, {
                'type':
                'Dictionary',
                'name':
                'informes',
                'description':
                '',
                'elements': [{
                    'type': 'String',
                    'name': 'fecha',
                    'description': ''
                }, {
                    'type': 'String',
                    'name': 'estapa',
                    'description': ''
                }, {
                    'type': 'String',
                    'name': 'informe',
                    'description': ''
                }, {
                    'type': 'String',
                    'name': 'link',
                    'description': ''
                }]
            }]
        }, {
            'type':
            'Dictionary',
            'name':
            'asistencia',
            'description':
            '',
            'elements': [{
                'type': 'String',
                'name': 'diputado_prmid',
                'description': ''
            }, {
                'type': 'String',
                'name': 'partido_prmid',
                'description': ''
            }, {
                'type': 'String',
                'name': 'asistencia',
                'description': ''
            }, {
                'type': 'String',
                'name': 'observacion',
                'description': ''
            }, {
                'type': 'String',
                'name': 'ingreso',
                'description': ''
            }]
        }, {
            'type':
            'Dictionary',
            'name':
            'intervenciones',
            'description':
            '',
            'elements': [{
                'type': 'String',
                'name': 'diputado_prmid',
                'description': ''
            }, {
                'type': 'String',
                'name': 'partido_prmid',
                'description': ''
            }, {
                'type': 'String',
                'name': 'etapa',
                'description': ''
            }, {
                'type': 'String',
                'name': 'detalle',
                'description': ''
            }, {
                'type': 'String',
                'name': 'documento',
                'description': ''
            }, {
                'type': 'String',
                'name': 'duracion',
                'description': ''
            }]
        }, {
            'type':
            'Dictionary',
            'name':
            'votaciones',
            'description':
            '',
            'elements': [{
                'type': 'String',
                'name': 'boletin',
                'description': ''
            }, {
                'type': 'List',
                'name': 'boletin_link',
                'description': ''
            }, {
                'type': 'String',
                'name': 'materia',
                'description': ''
            }, {
                'type': 'String',
                'name': 'artículo',
                'description': ''
            }, {
                'type': 'String',
                'name': 'tipo',
                'description': ''
            }, {
                'type': 'String',
                'name': 'tipo',
                'resultado': ''
            }, {
                'type': 'String',
                'name': 'votacion_prmid',
                'description': ''
            }, {
                'type': 'String',
                'name': 'favor',
                'description': ''
            }, {
                'type': 'String',
                'name': 'contra',
                'description': ''
            }, {
                'type': 'String',
                'name': 'abstencion',
                'description': ''
            }, {
                'type': 'String',
                'name': 'dispensados',
                'description': ''
            }]
        }, {
            'type':
            'Dictionary',
            'name':
            'acuerdos',
            'description':
            '',
            'elements': [{
                'type': 'String',
                'name': 'ingreso',
                'description': ''
            }, {
                'type': 'String',
                'name': 'numero',
                'description': ''
            }, {
                'type': 'String',
                'name': 'acuerdo_prmid',
                'description': ''
            }, {
                'type': 'String',
                'name': 'titulo',
                'description': ''
            }, {
                'type': 'String',
                'name': 'estado',
                'description': ''
            }]
        }]
    })
Exemplo n.º 3
0
scraperhelper.setOutputDescription(
        'Detalle de las mociones (Proyectos de Ley) creadas por los Diputados',
        {
            'type': 'Dictionary',
            'elements': [
                {'type': 'String','name': 'legislatura','description': '' },
                {'type': 'String','name': 'fecha','description': '' },
                {'type': 'String','name': 'estado','description': '' },
                {'type': 'String','name': 'boletin','description': '' },
                {'type': 'String','name': 'materia','description': '' },
                {'type': 'String','name': 'iniciativa','description': '' },
                {'type': 'String','name': 'origen','description': '' },
                {'type': 'String','name': 'prmid','description': '' },
                {'type': 'String','name': 'descripcion','description': '' },
                {
                    'type': 'Dictionary','name': 'hitos', 'description': '', 
                    'elements': [
                        {'type': 'String','name': 'fecha','description': '' },
                        {'type': 'String','name': 'sesios','description': '' },
                        {'type': 'String','name': 'etapa','description': '' },
                        {'type': 'String','name': 'sub_etapa','description': '' },
                        {'type': 'String','name': 'documento_link','description': '' }
                    ]
                },
                {
                    'type': 'Dictionary','name': 'informes', 'description': '', 
                    'elements': [
                        {'type': 'String','name': 'fecha','description': '' },
                        {'type': 'String','name': 'estapa','description': '' },
                        {'type': 'String','name': 'informe','description': '' },
                        {'type': 'String','name': 'documento_link','description': '' }
                    ]
                },
                {
                    'type': 'Dictionary','name': 'oficios', 'description': '', 
                    'elements': [
                        {'type': 'String','name': 'fecha','description': '' },
                        {'type': 'String','name': 'numero','description': '' },
                        {'type': 'String','name': 'etapa','description': '' },
                        {'type': 'String','name': 'oficio','description': '' },
                        {'type': 'String','name': 'documento_link','description': '' }
                    ]
                },
                {
                    'type': 'Dictionary','name': 'autores', 'description': '', 
                    'elements': [
                        {'type': 'String','name': 'nombre_diputado','description': '' },
                        {'type': 'List','name': 'region','description': '' },
                        {'type': 'String','name': 'distrito','description': '' },
                        {'type': 'String','name': 'partido','description': '' },
                        {'type': 'String','name': 'tipo','description': '' }
                    ]
                }
            ]
        }
)
Exemplo n.º 4
0
# -*- coding: utf-8 -*-
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import WebDriverException
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException

import imp
import scraperhelper
imp.reload(scraperhelper)

scraperhelper.setOutputDescription(
        'Lista de todas las sesiones de la cámara de Diputados para el período 2014-2018',
        {
            'type': 'Dictionary',
            'elements': [
                {'type': 'String', 'name': 'fecha', 'description': ''},
                {'type': 'String', 'name': 'sesion', 'description': ''},
                {'type': 'String', 'name': 'estado', 'description': ''},
                {'type': 'String', 'name': 'prmid', 'description': ''}
            ]
        }
)

scraperhelper.setPrintTimeTo(True)
browser = scraperhelper.initBrowser()

# output lists
data = []
errors = []

# main script GO!
try:
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException

import imp
import scraperhelper
imp.reload(scraperhelper)

scraperhelper.setOutputDescription(
    'Lista de todos los Diputados para el período 2014-2018', {
        'type':
        'Dictionary',
        'elements': [{
            'type': 'String',
            'name': 'prmid',
            'description': ''
        }, {
            'type': 'String',
            'name': 'nombre',
            'description': ''
        }, {
            'type': 'String',
            'name': 'periodo',
            'description': ''
        }]
    })

scraperhelper.setPrintTimeTo(True)
browser = scraperhelper.initBrowser()

# output lists
data = []
errors = []
Exemplo n.º 6
0
scraperhelper.setOutputDescription(
    'Lista de todos los proyectos de resolución de la cámara de Diputados para el período 2014-2018',
    {
        'type':
        'Dictionary',
        'elements': [{
            'type': 'String',
            'name': 'ingreso',
            'description': ''
        }, {
            'type': 'String',
            'name': 'numero',
            'description': ''
        }, {
            'type': 'String',
            'name': 'titulo',
            'description': ''
        }, {
            'type': 'String',
            'name': 'estado',
            'description': ''
        }, {
            'type': 'String',
            'name': 'documento_link',
            'description': ''
        }, {
            'type': 'String',
            'name': 'prmid',
            'description': ''
        }]
    })
Exemplo n.º 7
0
scraperhelper.setOutputDescription(
    'Detalle de todas las resoluciones para el período 2014-2018', {
        'type':
        'Dictionary',
        'elements': [{
            'type': 'String',
            'name': 'periodo',
            'description': ''
        }, {
            'type': 'String',
            'name': 'ingreso',
            'description': ''
        }, {
            'type': 'String',
            'name': 'numero',
            'description': ''
        }, {
            'type': 'String',
            'name': 'res_prmid',
            'description': ''
        }, {
            'type': 'String',
            'name': 'titulo',
            'description': ''
        }, {
            'type': 'String',
            'name': 'estado',
            'description': ''
        }, {
            'type':
            'Dictionary',
            'name':
            'autores',
            'description':
            '',
            'elements': [{
                'type': 'String',
                'name': 'nombre_diputado',
                'description': ''
            }, {
                'type': 'String',
                'name': 'prmid_diputado',
                'description': ''
            }, {
                'type': 'String',
                'name': 'partido',
                'description': ''
            }, {
                'type': 'String',
                'name': 'calidad',
                'description': ''
            }]
        }]
    })
Exemplo n.º 8
0
scraperhelper.setOutputDescription(
    'Lista de todos los Diputados para el período 2014-2018', {
        'type':
        'Dictionary',
        'elements': [{
            'type': 'String',
            'name': 'prmid',
            'description': ''
        }, {
            'type': 'String',
            'name': 'nombre',
            'description': ''
        }, {
            'type': 'String',
            'name': 'periodo',
            'description': ''
        }, {
            'type': 'String',
            'name': 'nacimiento',
            'description': ''
        }, {
            'type': 'String',
            'name': 'profesion',
            'description': ''
        }, {
            'type': 'String',
            'name': 'telefono',
            'description': ''
        }, {
            'type': 'String',
            'name': 'correo',
            'description': ''
        }, {
            'type': 'String',
            'name': 'comuna',
            'description': ''
        }, {
            'type': 'String',
            'name': 'distrito',
            'description': ''
        }, {
            'type': 'String',
            'name': 'region',
            'description': ''
        }, {
            'type': 'String',
            'name': 'periodos',
            'description': ''
        }, {
            'type': 'String',
            'name': 'comite_parlamentario',
            'description': ''
        }]
    })
Exemplo n.º 9
0
scraperhelper.setOutputDescription(
    'Detalle de todos los acuerdos para el período 2014-2018', {
        'type':
        'Dictionary',
        'elements': [{
            'type': 'String',
            'name': 'periodo',
            'description': ''
        }, {
            'type': 'String',
            'name': 'ingreso',
            'description': ''
        }, {
            'type': 'String',
            'name': 'numero',
            'description': ''
        }, {
            'type': 'String',
            'name': 'acuerdo_prmid',
            'description': ''
        }, {
            'type': 'String',
            'name': 'titulo',
            'description': ''
        }, {
            'type': 'String',
            'name': 'estado',
            'description': ''
        }, {
            'type':
            'Dictionary',
            'name':
            'autores',
            'description':
            '',
            'elements': [{
                'type': 'String',
                'name': 'nombre_diputado',
                'description': ''
            }, {
                'type': 'String',
                'name': 'prmid_diputado',
                'description': ''
            }, {
                'type': 'String',
                'name': 'partido',
                'description': ''
            }, {
                'type': 'String',
                'name': 'calidad',
                'description': ''
            }]
        }, {
            'type':
            'Dictionary',
            'name':
            'resumen',
            'description':
            '',
            'elements': [{
                'type': 'String',
                'name': 'despacho',
                'description': ''
            }, {
                'type': 'String',
                'name': 'numero',
                'description': ''
            }, {
                'type': 'String',
                'name': 'destinatario',
                'description': ''
            }, {
                'type': 'String',
                'name': 'entrega',
                'description': ''
            }, {
                'type': 'String',
                'name': 'documento_link',
                'description': ''
            }]
        }]
    })