Fixed app creation, RE: json issue
This commit is contained in:
@@ -339,14 +339,7 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet
|
||||
bodyAddin = ", data=body"
|
||||
|
||||
// FIXME: Does JSON data work?
|
||||
bodyFormatter = `
|
||||
if (body.startswith("{") and body.endswith("}")) or (body.startswith("[") and body.endswith("]")):
|
||||
try:
|
||||
body = json.dumps(body)
|
||||
except:
|
||||
pass
|
||||
`
|
||||
break
|
||||
bodyFormatter = `body = " ".join(body.strip().split())`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,13 +368,14 @@ func makePythoncode(swagger *openapi3.Swagger, name, url, method string, paramet
|
||||
|
||||
// Extra param for url if it's changeable
|
||||
// Extra param for authentication scheme(s)
|
||||
// The last weird one is the body.. Tabs & spaces sucks.
|
||||
data := fmt.Sprintf(` async def %s(self%s%s%s%s%s%s):
|
||||
%s
|
||||
url=f"%s%s"
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
%s
|
||||
return requests.%s(url, headers=headers%s%s%s).text
|
||||
`,
|
||||
functionname,
|
||||
|
||||
Reference in New Issue
Block a user