Spaces:
Sleeping
Sleeping
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) | |