跳转到主要内容

ATR xml文件处理器

项目描述

Gestor ATR

ATR处理程序,用于验证和分发不同网络参与者之间的XML消息。

部分

使用方法

Cli

此库提供atrhub客户端

$ gestor_atr --help
Usage: gestor_atr [OPTIONS]

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

如果引发任何异常,则返回$rc > 0,如果执行正常,则返回0!(无异常的空执行将正常,我的意思是,不需要处理任何文件的执行是正常执行)

工作目录

要处理的文件夹的优先级如下

    1. 通过--path传递
    1. --config,查找"DEAULT" -> "BASE_DIR"属性
    1. 检查默认路径的"DEAULT" -> "BASE_DIR"属性
    • ~/gestor_atr.ini
    • /etc/gestor_atr.ini
    1. 尝试默认路径/home/gestor_atr

配置示例

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

如何创建新用户?

只需使用bin/bin/create_ftp_user.sh工具

# #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

只需加载具有所需路径的ATRFiles

import atrhub

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

atr_files.deliver()

,这将

    1. 处理/tmp/atr_tree查找输出ATR文件
    1. 使用gestionatr验证每个匹配的文件
    • 还验证XML中请求的目标是否存在
    1. 将文件移动到目标位置
    1. 每个actionerror都会记录,将特定的日志文件保存在基本文件夹中,基于执行日期,例如0000/Salida/2019-01-14T19:55:59.log

日志示例

操作

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'

错误

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"

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

atrhub-0.4.6.tar.gz (5.9 kB 查看散列值)

上传时间

构建分发

atrhub-0.4.6-py2-none-any.whl (6.2 kB 查看散列值)

上传时间 Python 2

由以下支持