Skip to main content

ATR xml files handler

Project description

Gestor ATR

ATR processes handler devised to validate and dispatch XML messages over the different network actors.

Sections

Usage

Cli

This library provides the atrhub client:

$ gestor_atr --help
Usage: gestor_atr [OPTIONS]

Options:
  --config FILENAME  Provided configuration is not reachable
  --path PATH
  --help             Show this message and exit.

Will return $rc >0 if any exception is raised, 0 if execution is ok! (An empty execution without any raise will be ok, I mean, an execution that does not need to process any files is an ok execution)

Working directory

The priority for the fodler to be processed is the following:

    1. passed --path
    1. --config, looking for the "DEAULT" -> "BASE_DIR" property
    1. inspect default paths for the "DEAULT" -> "BASE_DIR" property
    • ~/gestor_atr.ini
    • /etc/gestor_atr.ini
    1. Try default path /home/gestor_atr

Config example

; atrhub.ini
[DEFAULT]
BASE_DIR = /home/atrhub/ftp

How to create new users?

Just use the bin/bin/create_ftp_user.sh tool:

# #This will create a new user, and set the needed grants to be able to interact with the atrhub

# bash src/create_ftp_user.sh AAAA XXXX
User created properly: AAAA : **********
 - Remember to test it using $ sftp AAAA@localhost

User created properly: XXXX : **********
 - Remember to test it using $ sftp XXXX@localhost

Library

Just load the ATRFiles with the desired path

import atrhub

atr_files = atrhub.ATRFiles(path="/tmp/atr_tree")

atr_files.deliver()

, this will

    1. process /tmp/atr_tree looking for outcoming ATR files
    1. validate every matched file using gestionatr
    • also validate that requested destination inside the XML exists
    1. move file to destination
    1. each action and error is logged saving an specific logfile inside the base folder based on the execution date i.e 0000/Salida/2019-01-14T19:55:59.log

Log examples

Action

2019-01-14 19:55:59,264 INFO     Moving file '/tmp/atr_tree/0034/Salida/M1_2.xml' to '/tmp/atr_tree/0762/Entrada/M1_2.xml'

Error

2019-01-14 19:55:59,297 ERROR    File '/tmp/atr_tree/0096/Salida/inexistent_destination.xml' is not accepted, wrong destinatary inside XML "0000"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atrhub-0.4.6.tar.gz (5.9 kB view hashes)

Uploaded Source

Built Distribution

atrhub-0.4.6-py2-none-any.whl (6.2 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page