Hello, I’m trying to get data from Post Request (SendGrid Webhook Event)
I’m getting this Error
Traceback (most recent call last):
File "/Users/sagar/frappe-bench/apps/frappe/frappe/app.py", line 58, in application
init_request(request)
File "/Users/sagar/frappe-bench/apps/frappe/frappe/app.py", line 118, in init_request
make_form_dict(request)
File "/Users/sagar/frappe-bench/apps/frappe/frappe/app.py", line 132, in make_form_dict
for k, v in iteritems(args) })
File "/Users/sagar/frappe-bench/env/lib/python2.7/site-packages/six.py", line 605, in iteritems
return d.iteritems(**kw)
AttributeError: 'list' object has no attribute 'iteritems'
Status: 500
Request Details
Content-Type : application/json
raw data:
[{"email":"john.doe@sendgrid.com","timestamp":1337197600,"smtp-id":"<4FB4041F.6080505@sendgrid.com>","event":"processed"},{"email":"john.doe@sendgrid.com","timestamp":1337966815,"category":"newuser","event":"click","url":"https://sendgrid.com"},{"email":"john.doe@sendgrid.com","timestamp":1337969592,"smtp-id":"<20120525181309.C1A9B40405B3@Example-Mac.local>","event":"processed"}]
Server-Side Code
@frappe.whitelist(allow_guest=True, xss_safe=True) def api_test(): if not frappe.request: return else: return frappe.request.data
When i'm changing(while testing in postman) to Content-Type to application/text Code will work but in json format code doesn't work