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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2

File details

Details for the file atrhub-0.4.6.tar.gz.

File metadata

  • Download URL: atrhub-0.4.6.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.27.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/2.7.18

File hashes

Hashes for atrhub-0.4.6.tar.gz
Algorithm Hash digest
SHA256 18e5bc7fa627c860ff487086b23ca316284abcbfbfc43a05a95fa1d04cbef2dc
MD5 a1bedd4e4007aa9bd789ff9ee96b1a70
BLAKE2b-256 c78380532a087b5e3e8d5e4d18085ceff42adff74fe15fbd6c1573bb84ce0703

See more details on using hashes here.

File details

Details for the file atrhub-0.4.6-py2-none-any.whl.

File metadata

  • Download URL: atrhub-0.4.6-py2-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.27.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/2.7.18

File hashes

Hashes for atrhub-0.4.6-py2-none-any.whl
Algorithm Hash digest
SHA256 68d670a253267cfaba000c38ca7173098759ca28a5d1883f55bb3ebd990d633b
MD5 d4fcd5ea64057c540f8f8146056df180
BLAKE2b-256 137b02473dba52da72394652670dcd09df73a28b2783a30136844bdfbfc6a469

See more details on using hashes here.

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