Spaces:
Sleeping
Sleeping
File size: 957 Bytes
889e2a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import requests
import os
# URL of the API endpoint
url = "https://vaibhav84-resumeapi.hf.space/UploadJobDescription/"
# Path to the file you want to upload
file_path = "d:/hug/job_desc_front_end_engineer.pdf"
file_name = os.path.basename(file_path)
# Open the file in binary mode
with open(file_path, "rb") as file:
# Prepare the file to be sent in the request
files = {"file": (file_path, file)}
# Additional parameters for the request
params = {"FileName": file_name} # Adjust FileName if necessary
# Make the POST request
response = requests.post(url, files=files, params=params)
# Check if the request was successful (status code 200)
if response.status_code == 200:
print("Job description uploaded successfully.")
# Print the response from the API
print(response.text)
else:
print("Failed to upload job description.")
print("Status code:", response.status_code)
print("Response:", response.text)
|