mirror of
https://github.com/simon987/od-database.git
synced 2025-04-19 18:36:44 +00:00
Bug when directory is empty with new file upload
This commit is contained in:
parent
898ffcf410
commit
8ef1d36c9d
@ -48,21 +48,22 @@ class TaskManager:
|
|||||||
logger.info("Uploading file list in small chunks")
|
logger.info("Uploading file list in small chunks")
|
||||||
filename = "./crawled/" + str(task_result.website_id) + ".json"
|
filename = "./crawled/" + str(task_result.website_id) + ".json"
|
||||||
CHUNK_SIZE = 1000000 * 10
|
CHUNK_SIZE = 1000000 * 10
|
||||||
with open(filename) as f:
|
if os.path.exists(filename):
|
||||||
chunk = f.read(CHUNK_SIZE)
|
with open(filename) as f:
|
||||||
while chunk:
|
|
||||||
payload = {
|
|
||||||
"token": config.API_TOKEN,
|
|
||||||
"website_id": task_result.website_id
|
|
||||||
}
|
|
||||||
|
|
||||||
files = {
|
|
||||||
"file_list": chunk
|
|
||||||
}
|
|
||||||
|
|
||||||
r = requests.post(config.SERVER_URL + "/task/upload", data=payload, files=files)
|
|
||||||
logger.info("RESPONSE: " + r.text)
|
|
||||||
chunk = f.read(CHUNK_SIZE)
|
chunk = f.read(CHUNK_SIZE)
|
||||||
|
while chunk:
|
||||||
|
payload = {
|
||||||
|
"token": config.API_TOKEN,
|
||||||
|
"website_id": task_result.website_id
|
||||||
|
}
|
||||||
|
|
||||||
|
files = {
|
||||||
|
"file_list": chunk
|
||||||
|
}
|
||||||
|
|
||||||
|
r = requests.post(config.SERVER_URL + "/task/upload", data=payload, files=files)
|
||||||
|
logger.info("RESPONSE: " + r.text)
|
||||||
|
chunk = f.read(CHUNK_SIZE)
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"token": config.API_TOKEN,
|
"token": config.API_TOKEN,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user