mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
I'de to add the Content-Type of the headers in order to get it working. See: https://github.com/paperless-ngx/paperless-ngx/discussions/7580
parent
1bec8c2c49
commit
24a261a523
@ -28,7 +28,10 @@ def _set_auth_tokens(paperless_url: str, timeout: float, session: requests.Sessi
|
|||||||
response = session.post(
|
response = session.post(
|
||||||
paperless_url + "/api/token/",
|
paperless_url + "/api/token/",
|
||||||
data=json.dumps(credentials),
|
data=json.dumps(credentials),
|
||||||
headers={"X-CSRFToken": csrf_token},
|
headers={
|
||||||
|
"X-CSRFToken": csrf_token,
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
@ -75,6 +78,7 @@ if __name__ == "__main__":
|
|||||||
# Update the document
|
# Update the document
|
||||||
resp = sess.patch(
|
resp = sess.patch(
|
||||||
paperless_url + f"/api/documents/{doc_pk}/",
|
paperless_url + f"/api/documents/{doc_pk}/",
|
||||||
|
headers={"Content-Type": "application/json"},
|
||||||
data=json.dumps({"correspondent": new_correspondent, "document_type": new_doc_type}),
|
data=json.dumps({"correspondent": new_correspondent, "document_type": new_doc_type}),
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user