Fixed file upload after pretixClient introduction
This commit is contained in:
parent
f233fb0b68
commit
b1a67e74e3
2
ext.py
2
ext.py
|
@ -162,7 +162,7 @@ class Order:
|
|||
localHeaders = dict(headers)
|
||||
localHeaders['Content-Type'] = mimeType
|
||||
localHeaders['Content-Disposition'] = f'attachment; filename="{fileName}"'
|
||||
res = await pretixClient.post("upload", baseUrl=base_url, headers=localHeaders, content=data)
|
||||
res = await pretixClient.post("upload", baseUrl=base_url, headers=localHeaders, content=data, expectedStatusCodes=[201])
|
||||
res = res.json()
|
||||
await self.edit_answer(name, res['id'])
|
||||
else:
|
||||
|
|
|
@ -30,11 +30,12 @@ async def doReq(url, httpxFunc, metricsFunc, expectedStatusCodes, opLogString) -
|
|||
for requests in range(PRETIX_REQUESTS_MAX):
|
||||
try:
|
||||
metricsFunc()
|
||||
res = await httpxFunc(client)
|
||||
res : httpx.Response = await httpxFunc(client)
|
||||
|
||||
if expectedStatusCodes is not None and res.status_code not in expectedStatusCodes:
|
||||
incPretixErrors()
|
||||
logger.warning(f"[PRETIX] Got an unexpected status code ({res.status_code}) while {opLogString} '{url}'. Allowed status codes: {', '.join(expectedStatusCodes)}")
|
||||
logger.warning(f"[PRETIX] Got an unexpected status code ({res.status_code}) while {opLogString} '{url}'. Allowed status codes: {', '.join(map(str, expectedStatusCodes))}")
|
||||
logger.debug(f"Response: '{res.text}'")
|
||||
continue
|
||||
break
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue