示例#1
0
def main(outfile):
    if not outfile.endswith(CSV_EXTENSION):
        outfile += CSV_EXTENSION
    site = Site()
    site.login(auto=True)
    services_category = site.categories['Κατάλογος Διαδικασιών']
    services_category_text = services_category.text()
    services_page_schema_xml = re.sub(r'{{.*}}',
                                      '',
                                      services_category_text,
                                      flags=re.S)
    services_page_schema = xmltodict.parse(services_page_schema_xml)
    # import json
    # print(json.dumps(services_page_schema, indent=4, ensure_ascii=False))
    with open(outfile, 'w') as f:
        csv_output = csv.writer(f)
        header_row = create_header_row()
        header_row_length = len(header_row)
        csv_output.writerow(header_row)
        templates = services_page_schema[PAGE_SCHEMA_KEY][TEMPLATE_KEY]
        for template in templates:
            for field in template[FIELD_KEY]:
                row = get_template_row(template)
                field_row = get_field_row(field)
                row.extend(field_row)
                row_length = len(row)
                assert row_length == header_row_length
                csv_output.writerow(row)
示例#2
0
 def __init__(self):
     self.__site = Site()
     self._site_logged_in = False
     # Dictionaries
     self.__data_by_code = {}
     self.__name_by_code = {}
     self.__code_by_name = {}
     self.__purpose_by_id = None
     self.__type_by_id = None
def main(outfile, namespace=PUBLISHED_NAMESPACE):
    if not outfile.endswith(CSV_EXTENSION):
        outfile += CSV_EXTENSION
    site = Site()
    site.login(auto=True)
    services_category = site.categories['Κατάλογος Διαδικασιών']

    with open(outfile, 'w') as f:
        csv_output = csv.DictWriter(f, fieldnames=header_row)

        csv_output.writeheader()

        for page in services_category:
            name = page.name
            split_name = name.split(':')
            ns = split_name[0]
            if ns == namespace:  # print only selected Namespace
                service_dict = _service_dict(TemplateEditor(page.text()), ns)
                # print(service_dict)
                csv_output.writerow(service_dict)

        f.close()
    'Πολίτες άλλων κρατώνΕνημέρωση και επικαιροποίηση στοιχείων πολίτη':
    'Πολίτες άλλων κρατών,Ενημέρωση και επικαιροποίηση στοιχείων πολίτη',
    'Πολίτες άλλων κρατώνΕξ αποστάσεως εξυπηρέτηση πολιτών':
    'Πολίτες άλλων κρατών,Εξ αποστάσεως εξυπηρέτηση πολιτών',
    'Πολίτες άλλων κρατώνΤουρισμός':
    'Πολίτες άλλων κρατών,Τουρισμός',
    'Τελωνειακές υπηρεσίεςΑδειοδοτήσεις και συμμόρφωση':
    'Τελωνειακές υπηρεσίες,Αδειοδοτήσεις και συμμόρφωση',
    'ΤηλεπικοινωνίεςΤαχυδρομεία':
    'Τηλεπικοινωνίες,Ταχυδρομεία',
    'ΤρόφιμαΓεωργία':
    'Τρόφιμα,Γεωργία',
    'ΤρόφιμαΕπιδοτήσεις':
    'Τρόφιμα,Επιδοτήσεις',
    'Φάκελος υγείαςΕπίσκεψη και νοσηλεία σε νοσοκομείο':
    'Φάκελος υγείας,Επίσκεψη και νοσηλεία σε νοσοκομείο',
    'Φορολογία επιχειρήσεωνΑπασχόληση προσωπικού':
    'Φορολογία επιχειρήσεων,Απασχόληση προσωπικού'
}

site = Site()
site.login(auto=True)

for page in site.categories[Service.CATEGORY_NAME]:
    page_text = page.text()
    for wrong_le, correct_le in WRONG_LIFE_EVENTS_MAP.items():
        if wrong_le in page_text:
            page.edit(page_text.replace(wrong_le, correct_le))
            print(f'Fixed life events {wrong_le} for {page.page_title}')
            break
示例#5
0
#!/usr/bin/env python3
from diavlos.src.site import Site

for page in Site().categories['Κατάλογος Φορέων']:
    page_title = page.page_title
    if 'Φορέας:' not in page_title:
        print(page_title)
示例#6
0
 def __init__(self, site=None):
     self._site = site or Site()
示例#7
0
from diavlos.src.eparavolo.error import eParavoloErrorCode
from diavlos.src.eparavolo.error import eParavoloErrorData
from diavlos.src.diaugeia.error import DiaugeiaErrorCode
from diavlos.src.diaugeia.error import DiaugeiaErrorData
from diavlos.src.helper.error import ErrorCode
from diavlos.src.metadata import Metadata
from diavlos.src.diaugeia import Diaugeia
from diavlos.src.organization import Organization
from diavlos.src.service import Service
from diavlos.src.service.error import ServiceErrorData
from diavlos.src.site import Site
from diavlos.src.site import SiteError

logging.basicConfig(level=logging.INFO)

default_site = greek_site = Site()
english_site = Site(config_file=IN_FILES['english_site_config'])
service = Service(site=default_site)
eparavolo = eParavolo()
organization = Organization()
metadata = Metadata()
diaugeia = Diaugeia()


def make_response(func):
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        result = func(*args, **kwargs)
        if isinstance(result, str) and not result.startswith('<'):
            response = {'success': False, 'message': result}
            status_code = 400
示例#8
0
#!/usr/bin/env python3
from diavlos.src.site import Site

for page in Site().categories['Κατάλογος Μητρώων']:
    page_title = page.page_title
    if 'Μητρώο:' not in page_title:
        print(page_title)