Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sat_session.login() #31

Open
ArmandoSep opened this issue Dec 3, 2024 · 0 comments
Open

sat_session.login() #31

ArmandoSep opened this issue Dec 3, 2024 · 0 comments

Comments

@ArmandoSep
Copy link

ArmandoSep commented Dec 3, 2024

Muchas gracias por tu iniciativa. Feliz se sumar al proyecto. Estoy intentando hacer login para explorar y me sale este error.

Estoy usando los archivos de prueba que compartiste.
30001000000400002436.cer
30001000000400002436.key
pass: 12345678a

Uso requests para llamar el cer y key ya que quiero almacenarlos en un s3 de AWS.

Codigo:

cer_url = 'https://acb-public.s3.us-east-1.amazonaws.com/sat/30001000000400002436.cer'
key_url = 'https://acb-public.s3.us-east-1.amazonaws.com/sat/30001000000400002436.key'
# Fetch the files
cer_response = requests.get(cer_url)
key_response = requests.get(key_url)
    
if cer_response.status_code == 200 and key_response.status_code == 200:
        signer = Signer.load(
            certificate=cer_response.content,
            key=key_response.content,
            password=sat_pass
        )
        
        sat_session = SATFacturaElectronica(signer)
        sat_session.login()

Error:

{
  "errorMessage": "'NoneType' object has no attribute 'attrs'",
  "errorType": "AttributeError",
  "requestId": "092b8abe-3394-4518-86f1-0ea900671d0c",
  "stackTrace": [
    "  File \"/var/task/lambda_function.py\", line 40, in lambda_handler\n    sat_session.login()\n",
    "  File \"/opt/python/satcfdi/portal/__init__.py\", line 135, in login\n    self._request_verification_token = request_verification_token(res)\n",
    "  File \"/opt/python/satcfdi/portal/utils.py\", line 83, in request_verification_token\n    return html.find(name='input', attrs={'name': '__RequestVerificationToken'}).attrs['value']\n"
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant