maas post returns "BAD request error"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Invalid
|
Undecided
|
Unassigned |
Bug Description
I am trying to execute a post request on MAAS.
That is what I need to do here is have to POST some details to MAAS using MAAS API.
So that I have followed the MAAS API documentation.
Using the same I can be able to process GET requests.
In the mean time when I am attempting to do a POST request I am getting error as follows:
<pre>
File "vag_1.py", line 105, in <module>
maas_
File "/usr/lib/
url, method="POST", headers=headers, data=body)
File "/usr/lib/
res = urllib2.
File "/usr/lib/
return _opener.open(url, data, timeout)
File "/usr/lib/
response = meth(req, response)
File "/usr/lib/
'http', request, response, code, msg, hdrs)
File "/usr/lib/
return self._call_
File "/usr/lib/
result = func(*args)
File "/usr/lib/
raise HTTPError(
urllib2.HTTPError: HTTP Error 400: BAD REQUEST.
</pre>
My code for post is as follows:
<pre>
argument_parser = argparse.
argument_
argument_
argument_
argument_
params = {"username": "newuser", "email": "<email address hidden>", "password": "newuser", "is_superuser": "1"}
maas_access.
</pre>
What I am doing wrong here.
Please let me know the proper way for doing the same.
Atleast provide with me any proper logs to trace the same.
description: | updated |
I can get the correct result for normal POST without data.
For the following request:
# creating authorization token post(u" account/ ", "create_ authorisation_ token")
maas_access.
But in case of POST request like above I amalways getting an error