-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding Swagger documentation to petfuc.py
- Loading branch information
IshayuR
committed
Nov 6, 2024
1 parent
8d29d0c
commit 5d7ee3f
Showing
1 changed file
with
28 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,35 @@ | ||
""" | ||
This module provides functions for HTTP communication and | ||
route functions | ||
This module provides backend functions to manage pet-related data. | ||
""" | ||
from flask import jsonify | ||
|
||
|
||
def get_random_pet(): | ||
""" | ||
Function to generate random ID and return pet | ||
asscoieted with that ID | ||
Generates a random ID and returns information associated with that ID. | ||
This function simulates accessing a database to fetch pet information | ||
based on a randomly generated pet ID. | ||
Returns: | ||
dict: A dictionary containing pet data, suitable for JSON response. | ||
Example return: | ||
{ | ||
"id": "9", | ||
"name": "Sam", | ||
"sex": "Male", | ||
"Age": "8", | ||
"location": "Connecticut", | ||
"Breed": "Pug" | ||
} | ||
""" | ||
randomint = "9" # APi generates random interger that represents a PET ID | ||
# Api accesses database and return information in data base | ||
#Retrun information such as profile picture on the pet accosiated with the random ID | ||
data = {"id": randomint, | ||
"name":"sam", | ||
"sex":"male", | ||
"Age":"8", | ||
"location":"Connecticwut", | ||
"Breed": "Pug"} | ||
return jsonify(data) # Return dog information | ||
random_int = "9" # API generates random integer that represents a PET ID | ||
data = { | ||
"id": random_int, | ||
"name": "Sam", | ||
"sex": "Male", | ||
"Age": "8", | ||
"location": "Connecticut", | ||
"Breed": "Pug" | ||
} | ||
return data # Return pet information as a dictionary | ||
|