async with self.session.post(url=self.authentication_url, headers=self.headers, json=self.data) as res:
^^^^
Otherwise, the request body will contain single quoted property keys, thus the 500 error will occur.
Is this an unforeseen case, or the body must not be JSON? Either way, the solution with the provided XML will not work unless the body is defined as json.
Using the example_generic.py, when trying to connect to the rest API, a 500 error is received.
As I figured it out, when sending the /authenticate post request, its body is defined as
data
: https://github.com/SmartGridready/SGrPython/blob/c3aeabdaefbc777d54214f75775c549319a62cf7/sgr_library/restapi_client_async.py#L139 However, according to the provided XML, we have to send a JSON body in order to properly authenticate, therefore, I had to define the body asjson
:Otherwise, the request body will contain single quoted property keys, thus the 500 error will occur.
Is this an unforeseen case, or the body must not be JSON? Either way, the solution with the provided XML will not work unless the body is defined as
json
.Request body defined in the XML:
Request body within the actual post request: