This blog covers the work done by me in the 5th week of GSoC. This week also marks the end of the first phase and with this work I will enter the first evaluation phase which is scheduled from 12th to 16th July. The work mentioned in this blog can be found in
PR#69
What did I do?
As mentioned before my mentors had asked me to work on
python entry points which basically allow us to call scripts directly from the
command line using one word
name. These entry points are installed when we install the package with the command
python setup.py install. They allow an easy way to call scripts with their command line options with just one word instead of mentioning the whole whole module.
To do this I had to add a
main() function to many scripts that contained all the command line options. This function would ultimately serve as the
entry point of the scripts when called from the command line. While doing this I also had to keep in mind the variables that were modified inside this function because I would have to define a global declaration for them. This mainly constituted my work in the 5th week. The scripts for which I added entry points were:-
- cot
- iibb
- padron
- pyemail
- pyfepdf
- pyi25
- pyqr
- rece1
- receb1
- recem
- recet
- recex1
- rg3685
- sired
- trazafito
- trazamed
- trazaprodmed
- trazarenpre
- trazavet
- wdigdepfiel
- ws_sire
- ws_sr_padron
- wsaa
- wsbfev1
- wscdc
- wscoc
- wsct
- wsctg
- wsfecred
- wsfev1
- wsfexv1
- wslpg
- wslsp
- wsltv
- wslum
- wsmtx
- wsremazucar
- wsremcarne
- wsremharina
I chose to add the entry points inside the
setup.cfg file instead of
setup.py file, because the configuration file was already present inside the package.
What problems did I face?
I think this was the only week that I can say that I did not face any significant problems. Since adding entry points was a straight-forward task, I only had to invest some time for this task. Although initially I did get stuck while finding the function that would serve as the entry point for the scripts. The problem was that not all scripts had a
main() function in them, nor did the have a proper function that would serve as the entry point. Then with some tinkering and the help of my mentors I decided to add a
main function in all the scripts. After this it was only a matter of adding them in the configuration file and making
global declarations for the variables that were modified.
Results
$ wsaa
para soporte de WebClient debe instalar httplib2
Encodign in cp1252
Usando CRT=reingart.crt KEY=reingart.key URL=https://wsaahomo.afip.gov.ar/ws/services/LoginCms SERVICE=wsfe TTL=36000
WSAA Version 3.11c False
<loginticketresponse version="1.0">
<source>CN=wsaahomo, O=AFIP, C=AR, SERIALNUMBER=CUIT 33693450239
<destination>SERIALNUMBER=CUIT 20267565393, CN=reingart2019pub</destination>
<uniqueid>657428365</uniqueid>
<generationtime>2021-07-09T13:51:57.149-03:00</generationtime>
<expirationtime>2021-07-10T01:51:57.149-03:00</expirationtime>
<credentials>
<token>P+Cg==</token>
<sign>s4M0=</sign>
</credentials>
</loginticketresponse>
$ wsfev1 --prueba
para soporte de WebClient debe instalar httplib2
Leyendo TA de C:\Users\pyafipws\py3test\lib\site-packages\pyafipws-3.9.b_2514_-py3.9.egg\pyafipws\cache\TA-2b4277f5962bd2cb0265c0fac4b32304.xml...
b"FECAESolicitar(Auth=*{'Token': <class 'str'="">, 'Sign': <class 'str'="">, 'Cuit': <alias 'long'="" for="" '<class="" 'int'="">'>}*, FeCAEReq=*{'FeCabReq':
*{'CantReg': <class 'int'="">, 'PtoVta': <class 'int'="">, 'CbteTipo': <class 'int'="">}*, 'FeDetReq': [*{'FECAEDetRequest': *{'Concepto': <class 'int'="">, 'DocTipo': <class 'sg':="" <class="" 'str'="">}*}*], 'Errors': [*{'Err': *{'Code': <class 'int'="">, 'Msg': <class 'str'="">}*}*]}*}**:\n\nSolicitud de C\xf3digo de Autorizaci\xf3n Electr\xf3nico (CAE)\nHeaders: None"</class></class></class></class></class></class></class></alias></class></class>
Nro. Cbte. desde-hasta 493 493
Resultado A
Reproceso
CAE 71283954824423
Vencimiento 20210719
Observaciones 10217: El credito fiscal discriminado en el presente comprobante solo podra ser computado a efectos del Procedimiento permanente de transicion al Regimen General.
71283954824423 == 71283954824423
3 != 2
10217 != 10017
El credito fiscal discriminado en el presente comprobante solo podra ser computado a efectos del Procedimiento permanente de transicion al Regimen General.
$ pyfepdf --prueba --mostrar
para soporte de WebClient debe instalar httplib2
Encodign in cp1252
Prueba!