Spaces:
Sleeping
Sleeping
import requests | |
from pydantic import BaseModel | |
class UserAddNewSkill: | |
# Define the class for the input data | |
class AddSkillDetails(BaseModel): | |
SkillName: str = 'SkillName' | |
SkillType: str = 'Soft Skill' | |
SkillScore: int = 10 | |
# Define the data to be sent to the API | |
def AddNewSkill(API, skillName1,SkillType1,SkillScore1): | |
data = UserAddNewSkill.AddSkillDetails( | |
SkillName=skillName1, | |
SkillType=SkillType1, | |
SkillScore=SkillScore1 # Example score | |
) | |
# URL of the API endpoint | |
#url = "https://vaibhav84-resumeapi.hf.space/AddSkillDetails/" | |
# Make the POST request | |
response = requests.post(API, json=data.dict()) | |
# Check the response | |
if response.status_code == 200: | |
print("Skill details added successfully.") | |
print("Response:", response.json()) | |
else: | |
print("Failed to add skill details.") | |
print("Status code:", response.status_code) | |
print("Response:", response.text) | |