Skip to main content

'list' object has no attribute 'get'

  • October 9, 2024
  • 0 replies
  • 30 views

Forum|alt.badge.img

In Magento2.4.7

when i try to hit one of klavio api with GuzzleHttp  it return this in response

This is my code
$exportDetails[]= [
                    "email"=>$customer->getEmail(),
                    "firstname"=>$customer->getFirstname(),
                    "lastname"=>$customer->getLastname(),
                ];
$apiUrl = 'some klavio api';

$client = new GuzzleHttp\Client();
$options = [
    'headers' => [
        'Content-Type' => 'application/json',
    ],
    'body' => \json_encode($exportDetails),
];
$response = $client->post($apiUrl, $options);
"errorMessage": "'list' object has no attribute 'get'","errorType": "AttributeError","requestId": "a00b91c2-b0e3-4b28-93f6-5ceeebc51d70","stackTrace": [    "  File \"\/var\/task\/klaviyoFreeTrial.py\", line 6, in lambda_handler\n    customer_email = event.get('email', None)\n"]

another api response after order place

"errorMessage": "'list' object has no attribute 'get'","errorType": "AttributeError","requestId": "f3c3a094-ae9b-47c5-8550-eb6adddcfcd1","stackTrace": [    "  File \"\/var\/task\/klaviyoPurchase.py\", line 21, in lambda_handler\n    customer_email = webhook_data.get('email', None)\n"]
Did this topic or the replies in the thread help you find an answer to your question?

0 replies

Be the first to reply!