Spaces:
Running
Running
| from fastapi import HTTPException | |
| def check_country_code(request): | |
| if request.country not in ["CL", "MX"]: | |
| raise HTTPException( | |
| status_code=400, detail=f"Invalid country code: {request.country}" | |
| ) | |
| else: | |
| return print("correct country code") | |
| def check_valid_ids(request, df): | |
| invalid_ids = set(request.invoiceId) - set(df.index) | |
| if invalid_ids: | |
| raise HTTPException( | |
| status_code=400, detail=f"Invalid invoiceId(s): {invalid_ids}" | |
| ) | |
| else: | |
| return print("invoice ids are valid") | |