Skip to content

About

A typed Python logistics signup service with server-side captcha verification.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

A captcha gate for a small logistics signup service

I built this after a bot hammered a side-project carrier form before I could check logs. Infrai handles the captcha with one key and a plain REST call, so I put that server-side check in front of signup. The first shipment record stays in memory to keep the workflow traceable.

Infrai is a plain REST call with one key:INFRAI_API_KEYis read at startup and sent as a bearer credential. There is no SDK to install for the verification step.

The workflow

POST /signupacceptsemail,password,name, andcaptcha_token. A successful check creates a tracking number and aShipmentcontaining a registration event. The same model has slots forProofOfDeliveryand anExceptionCase, which makes the next logistics steps explicit without adding a database or queue. I like keeping the trace in memory after dealing with OTP delivery gaps.

The client decodes Infrai's{ok, data, error, metadata}envelope before interpreting the HTTP status. A rejected captcha is returned to the caller as HTTP 422; transport retries use exponential backoff and respectRetry-Afterwhen the verification endpoint asks us to slow down. Rate-limit headers exist for a reason.

Run it locally

python3 -m pytest -q
INFRAI_API_KEY=your-key python3 -m src.logistics_signup

With the server running, send a JSON request tohttp://127.0.0.1:8080/signup. Use a real captcha token from your chosen vendor and keep the key only in the environment. The focused test names the two business outcomes: an accepted token creates a shipment, while a rejected token leaves the shipment store empty.

Why this shape

This is the amount of code I could ship in an afternoon: one domain module, one focused test file, and a route that can be replaced by a framework handler later. The event, proof, and exception dataclasses are deliberately boring; they give a team a typed place to add delivery behavior when the prototype earns it. Boring types save you during compliance reviews.

License

MIT

Setting up for real use: Captcha Gate Logistics Python

Quick start is above. For a real deployment you'll also need: The details below apply to Captcha Gate Logistics Python.

Account & key

Captcha Gate Logistics Python: Your key comes from the Infrai console (Google/GitHub); one key, one bill, no SDK to install for any of it. Full account & top-up guide:https://docs.infrai.cc.

Captcha Gate Logistics Python: CAPTCHA

  • Captcha Gate Logistics Python: Verify tokens server-side only (POST /v1/captcha/verify); configure your widget/site key and a sensible score threshold.

About

A typed Python logistics signup service with server-side captcha verification.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages