Discussions

Ask a Question
Back to All

HTTP Error 403: Forbidden

(edited)

I'm using python 3+ and getting this error.

values = {
"platform_name": "Amazon",
"platform_order_number": "#1234",
"selected_courier_id": "b8d528a7-a2d4-4510-a7ac-11cbbb6542cd",
"destination_country_alpha2": "US",
"destination_city": "New York",
"destination_postal_code": "10022",
"destination_state": "NY",
"destination_name": "Aloha Chen",
"destination_address_line_1": "300 Park Avenue",
"destination_address_line_2": 'null',
"destination_phone_number": "+1 234-567-890",
"destination_email_address": "[email protected]",
"items": [
{
"description": "Silk dress",
"sku": "test",
"actual_weight": 1.2,
"height": 10,
"width": 15,
"length": 20,
"category": "fashion",
"declared_currency": "SGD",
"declared_customs_value": 100
}
]
}

    headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer  prod_xxxxxxxxxx'
    }
    request = Request('https://api.easyship.com/shipment/v1/shipments', data=bytes(json.dumps(values),encoding="utf-8"), headers=headers)

    response_body = urllib.request.urlopen(request).read()
    print(response_body)