'Django Forms to an API payload?
I am using a Django form to generate my HTML form. I wanted to use the data from my form as an API payload.
if request.method == 'POST':
form = GetKeyForm(request.POST)
if form.is_valid():
appkey = form.cleaned_data['appkey']
secretkey = form.cleaned_data['secretkey']
shop_token = form.cleaned_data['shop_token']
shop_domain = form.cleaned_data['shop_domain']
payload = {
"account_platform": {
"shop_token": {shop_token},
"shop_secret": "",
"shop_domain": {shop_domain},
},
"utoken": {utoken}
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
This is the error that I am getting: Object of type set is not JSON serializable
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
