Skip to content

Instantly share code, notes, and snippets.

@BoboTiG
Created January 20, 2021 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoboTiG/65204ee9587c838bee29f12ac28c1400 to your computer and use it in GitHub Desktop.
Save BoboTiG/65204ee9587c838bee29f12ac28c1400 to your computer and use it in GitHub Desktop.
Medium - The Mystery of the Endless HTTPS Call
import http.client
import json
conn = http.client.HTTPSConnection("<HOST>")
url = "/nuxeo/api/v1/upload/<BATCH_ID>/0/execute/FileManager.Import"
headers = {
"X-Batch-No-Drop": "true",
"Content-Type": "application/json",
"Cookie": "X-Authentication-Token=<TOKEN>",
}
params = {"context": {"currentDocument":"/default-domain/UserWorkspaces/<USER>"}}
try:
conn.request("POST", url, json.dumps(params).encode("utf-8"), headers)
req = conn.getresponse()
except KeyboardInterrupt:
print("CTRL+C hit!")
else:
print(json.loads(req.read().decode("utf-8")))
finally:
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment