Skip to main content

'list' object has no attribute 'get'

  • October 9, 2024
  • 0 replies
  • 44 views

Forum|alt.badge.img+2

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"]