Skip to content

Handling Sandbox and production URLs in views.py #4

@ashish-naik

Description

@ashish-naik

Hi

Thanks for writing this code. I would like to handle sandbox and production URL in same code. I don't know Python so wanted to check whether below code looks fine in views.py. Everything remains same.

I have added URL variables to handle this.

response = requests.post(settings.RECEIPT_VERIFICATION_URL_PRODUCTION, data=json.dumps(data))
payload = response.json()
status = payload["status"]
if status == 21007
response = requests.post(settings.RECEIPT_VERIFICATION_URL_SANDBOX, data=json.dumps(data))
payload = response.json()
response = JSONResponse(payload)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions