add cep and cnpj to api

This commit is contained in:
2025-12-28 18:48:55 -03:00
parent 8b81d5c245
commit f7d1854309
7 changed files with 185 additions and 151 deletions

View File

@@ -1,4 +1,3 @@
import json
from datetime import datetime, timedelta
from typing import NotRequired, TypedDict
@@ -135,24 +134,22 @@ def _generate_cert(
# Send template URI and data to Paperforge API to generate a PDF
r = requests.post(
PAPERFORGE_API,
data=json.dumps(
{
'template_uri': cert['s3_uri'],
'args': {
'name': user['name'],
'cpf': _cpffmt(user['cpf']),
'score': score,
'started_at': started_at.strftime('%d/%m/%Y'),
'completed_at': completed_at.strftime('%d/%m/%Y'),
'today': _datefmt(now_),
'year': now_.strftime('%Y'),
'expires_at': expires_at.strftime('%d/%m/%Y')
if expires_at
else None,
},
json={
'template_uri': cert['s3_uri'],
'args': {
'name': user['name'],
'cpf': _cpffmt(user['cpf']),
'score': score,
'started_at': started_at.strftime('%d/%m/%Y'),
'completed_at': completed_at.strftime('%d/%m/%Y'),
'today': _datefmt(now_),
'year': now_.strftime('%Y'),
'expires_at': expires_at.strftime('%d/%m/%Y')
if expires_at
else None,
},
),
timeout=6,
},
timeout=(1, 3),
)
r.raise_for_status()