|
import requests |
|
import os |
|
import time |
|
|
|
url = "https://vaibhav84-resumeapi.hf.space/UploadJobDescription/" |
|
|
|
def CallAPI(file_path): |
|
|
|
with open(file_path, "rb") as file: |
|
|
|
files = {"file": (file_path, file)} |
|
|
|
|
|
params = {"FileName": file_name} |
|
start_time = time.time() |
|
|
|
response = requests.post(url, files=files, params=params) |
|
end_time = time.time() |
|
total_time = end_time - start_time |
|
|
|
if response.status_code == 200: |
|
print("_____________________________________________________") |
|
print("Job description uploaded successfully.", file_name) |
|
print("") |
|
|
|
print(response.text) |
|
print("") |
|
print("Total time:", total_time, "seconds") |
|
print("_____________________________________________________") |
|
else: |
|
print("Failed to upload job description.") |
|
print("Status code:", response.status_code) |
|
print("Response:", response.text) |
|
|
|
folderPath = "Data" |
|
files = os.listdir(folderPath) |
|
for file in files: |
|
|
|
filePath = os.path.join(folderPath, file) |
|
file_name = os.path.basename(filePath) |
|
CallAPI(filePath) |
|
|
|
|
|
|
|
|
|
|
|
|