Skip to content

Commit 9000cf8

Browse files
authored
Merge branch 'main' into coverage_receb1
2 parents c3f0fb5 + 3a18835 commit 9000cf8

File tree

184 files changed

+22154
-167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+22154
-167
lines changed

.coveragerc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@ omit =
55
*iibb*
66
*nsis*
77
*/padron.py
8-
*pyemail*
9-
*pyfepdf*
10-
*pyi25*
11-
*pyqr*
12-
*rece1*
13-
*recem*
148
*recet*
15-
*recex1*
9+
*formatos*
1610
*rg3685*
1711
*setup_win*
1812
*sired*

.github/workflows/python-package.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,20 @@ jobs:
4141
python setup.py install
4242
- name: Download certificate and private key
4343
run: |
44-
wget https://www.sistemasagiles.com.ar/soft/pyafipws/reingart2019.zip
44+
wget "https://www.sistemasagiles.com.ar/soft/pyafipws/reingart2021.zip" -O reingart2019.zip
4545
unzip reingart2019.zip
4646
- name: Fix OpenSSL "dh key too small"
4747
run: |
4848
sudo cp .github/openssl.cnf /etc/ssl/openssl.cnf
49+
- name: Copy rece.ini file
50+
run: |
51+
sudo cp conf/rece.ini rece.ini
52+
- name: Copy wsltv.ini file
53+
run: |
54+
sudo cp conf/wsltv.ini wsltv.ini
55+
- name: Copy wslsp.ini file
56+
run: |
57+
sudo cp conf/wslsp.ini wslsp.ini
4958
- name: Test with pytest
5059
run: |
5160
pytest --html=report.html --self-contained-html

conf/rece.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ ENTRADA=entrada.txt
4242
SALIDA=salida.txt
4343
##URL=https://servicios1.afip.gov.ar/wsfe/service.asmx
4444

45+
[WSFEXv1]
46+
CUIT=20267565393
47+
ENTRADA=entrada.txt
48+
SALIDA=salida.txt
49+
##URL=https://servicios1.afip.gov.ar/wsfe/service.asmx
50+
4551
[WSCT]
4652
CUIT=20267565393
4753
ENTRADA=entrada.txt
@@ -78,7 +84,7 @@ LOCALE=Spanish_Argentina.1252
7884
FMT_CANTIDAD=0.4
7985
FMT_PRECIO=0.3
8086
CANT_POS=izq
81-
ENTRADA=factura.txt
87+
ENTRADA=facturas.txt
8288
SALIDA=factura.pdf
8389

8490
[PDF]

conf/wslsp.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[WSAA]
2+
CERT = reingart.crt
3+
PRIVATEKEY = reingart.key
4+
## URL = https: //wsaa.afip.gov.ar/ws/services/LoginCms
5+
6+
[WSLSP]
7+
CUIT = 20267565393
8+
INPUT = invoices.csv
9+
OUTPUT = OUTPUT.txt
10+
ENTRADA=entrada.txt
11+
SALIDA=salida.txt
12+
## URL = https: //serviciosjava.afip.gob.ar/wslsp/LumService? Wsdl

conf/wsltv.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[WSAA]
2+
CERT = reingart.crt
3+
PRIVATEKEY = reingart.key
4+
## URL = https: //wsaa.afip.gov.ar/ws/services/LoginCms
5+
6+
[WSLTV]
7+
CUIT = 20267565393
8+
INPUT = invoices.csv
9+
OUTPUT = OUTPUT.txt
10+
ENTRADA=entrada.txt
11+
SALIDA=salida.txt
12+
## URL = https: //serviciosjava.afip.gob.ar/wsltv/LtvService? Wsdl

formatos/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf8 -*-
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU Lesser General Public License as published by the
5+
# Free Software Foundation; either version 3, or (at your option) any later
6+
# version.
7+
#
8+
# This program is distributed in the hope that it will be useful, but
9+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
10+
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11+
# for more details.
12+
13+
"""Módulo para acceder a web services de la afip
14+
"""
15+
__author__ = "Mariano Reingart ([email protected])"
16+
__copyright__ = "Copyright (C) 2008-2021 Mariano Reingart"
17+
__license__ = "LGPL-3.0-or-later"

formatos/formato_dbf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
# definición del formato del archivo de intercambio:
4242

43-
from formato_txt import (
43+
from .formato_txt import (
4444
A,
4545
N,
4646
I,

formatos/formato_json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def leer(fn="entrada.json"):
3636
return regs
3737

3838

39-
def escribir(filas, fn="salida.json"):
39+
def escribir(filas, fn="salida.json", **kwargs):
4040
"Dado una lista de comprobantes (diccionarios), escribe JSON"
4141
import codecs
4242

@@ -46,6 +46,6 @@ def escribir(filas, fn="salida.json"):
4646
jsonfile,
4747
sort_keys=True,
4848
indent=4,
49-
encoding="utf-8",
49+
**kwargs
5050
)
5151
jsonfile.close()

formatos/formato_txt.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
__license__ = "LGPL-3.0-or-later"
2222

2323
from decimal import Decimal
24+
import sys
2425

2526
CHARSET = "latin1"
2627

@@ -117,7 +118,7 @@
117118
("imp_iva", 15, I),
118119
("despacho", 20, A),
119120
("u_mtx", 10, N),
120-
("cod_mtx", 30, A),
121+
("cod_mtx", 30, N),
121122
("dato_a", 15, A),
122123
("dato_b", 15, A),
123124
("dato_c", 15, A),
@@ -229,8 +230,9 @@ def escribir_linea_txt(dic, formato):
229230
valor = dic.get(clave, "")
230231
if not isinstance(valor, basestring):
231232
valor = str(valor)
232-
if isinstance(valor, str):
233-
valor = valor.encode(CHARSET, "replace")
233+
if sys.version_info[0] < 3 :
234+
if isinstance(valor, str):
235+
valor = valor.encode(CHARSET, "replace")
234236
if valor == "None":
235237
valor = ""
236238
if tipo == N and valor and valor != "NULL":
@@ -257,7 +259,7 @@ def escribir_linea_txt(dic, formato):
257259

258260
def leer(fn="entrada.txt"):
259261
"Analiza un archivo TXT y devuelve un diccionario"
260-
f_entrada = open(fn, "r")
262+
f_entrada = open(fn, "rb")
261263
try:
262264
regs = []
263265
reg = None

pyemail.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ def Conectar(self, servidor, usuario=None, clave=None, puerto=25):
9292
# inicio una sesión segura (TLS)
9393
self.smtp.starttls()
9494
if usuario and clave:
95-
# convertir a string (hmac necesita string "bytes")
96-
if isinstance(usuario, str):
97-
usuario = usuario.encode("utf8")
98-
if isinstance(clave, str):
99-
clave = clave.encode("utf8")
95+
if sys.version_info[0] < 3:
96+
#convertir a string (hmac necesita string "bytes")
97+
if isinstance(usuario, str):
98+
usuario = usuario.encode("utf8")
99+
if isinstance(clave, str):
100+
clave = clave.encode("utf8")
100101
self.smtp.login(usuario, clave)
101102
return True
102103
except Exception as e:
@@ -275,10 +276,14 @@ def main():
275276
elif "/prueba" in sys.argv:
276277
pyemail = PyEmail()
277278
import getpass
278-
279-
usuario = input("usuario:")
280-
clave = getpass.getpass("clave:")
281-
ok = pyemail.Conectar("smtp.gmail.com", "reingart", clave, 587)
279+
i = sys.argv.index("/prueba")
280+
if i + 2 < len(sys.argv):
281+
usuario = sys.argv[sys.argv.index("/prueba") + 1]
282+
clave = sys.argv[sys.argv.index("/prueba") + 2]
283+
else:
284+
usuario = input("usuario:")
285+
clave = getpass.getpass("clave:")
286+
ok = pyemail.Conectar("smtp.gmail.com", usuario=usuario, clave=clave, puerto=587)
282287
print("login ok?", ok, pyemail.Excepcion)
283288
print(pyemail.Traceback)
284289
ok = pyemail.Enviar(usuario, "prueba", usuario, "prueba!", None)

0 commit comments

Comments
 (0)