wright-way-scraper
wright_way_scraper.WrightWayScraper
#
A client for the Petango API, specifically for the Wright-Way Rescue shelter.
Initialize the WrightWayScraper client with the base URL and authentication key.
Source code in wright_way_scraper/client.py
get_animal
#
Parse the HTML for a single animal and return an Animal Pydantic model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
int | str
|
The unique Petango identifier for the animal. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If any of the required fields are missing from the HTML. |
Returns:
| Name | Type | Description |
|---|---|---|
Animal |
Animal
|
A Pydantic model representing an animal available for adoption. |
Source code in wright_way_scraper/client.py
get_animal_html_url
#
Get the URL for the Petango HTML page for a single animal.
This page is embedded in a frame on the Wright-Way Rescue website. The URL is constructed using the Petango ID of the animal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
int | str
|
The Petango ID of the animal. |
required |
auth_key
|
str | None
|
The authentication key for the Petango API. If None, the client's default key is used. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The URL for the Petango HTML page for the animal. |
Source code in wright_way_scraper/client.py
get_animal_ids
#
Parse the HTML table of all animals and return a list of their Petango ids.
Returns:
| Type | Description |
|---|---|
list[int]
|
list[int]: A list of Petango ids for all animals available for adoption. |
Source code in wright_way_scraper/client.py
get_animal_xml_url
#
Get the URL for the Petango API to get the details of a single animal.
This URL is used to get the XML data for a single animal from the Petango API. It is not the URL for the HTML page for the animal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_
|
int | str
|
The Petango ID of the animal. |
required |
auth_key
|
str | None
|
The authentication key for the Petango API. If None, the client's default key is used. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The URL for the Petango API to get the details of a single animal. |
Source code in wright_way_scraper/client.py
get_animals
#
Get all animals available for adoption.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ids
|
list[int] | None
|
A list of Petango ids for animals available for adoption. If None, the list will be generated by calling self.get_animal_ids(). |
None
|
Returns:
| Type | Description |
|---|---|
list[Animal]
|
list[Animal]: A list of Pydantic models representing animals available for adoption. |
Source code in wright_way_scraper/client.py
get_animals_xml_url
#
Get the URL for the Petango API to get all animals available for adoption.
This URL is used to get the XML data for all animals available for adoption from the Petango API. It is not the URL for the HTML page for the animals, as seen on the Wright-Way Rescue website.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
auth_key
|
str | None
|
The authentication key for the Petango API. If None, the client's default key is used. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The URL for the Petango API to get all animals available for adoption. |
Source code in wright_way_scraper/client.py
wright_way_scraper.Animal
#
Bases: BaseModel
A model representing an animal available for adoption from the Wright-Way Rescue.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
The unique Petango identifier for the animal. |
Name |
str
|
The name of the animal. |
Species |
Literal['Cat', 'Dog']
|
The species of the animal. |
Breed |
str
|
The breed of the animal. |
Birthdate |
datetime | str | None
|
The birthdate of the animal. |
Gender |
Literal['Male', 'Female', 'Unknown']
|
The gender of the animal. |
Size |
str
|
The size of the animal. |
Color |
str
|
The color of the animal. |
Declawed |
Literal['Yes', 'No', 'Unknown']
|
Whether the animal is declawed. |
Housetrained |
Literal['Yes', 'No', 'Unknown']
|
Whether the animal is house-trained. |
Location |
str
|
The location of the animal. |
Intake_Date |
datetime | str
|
The date the animal was taken in by the shelter. |
Stage |
Literal['Reserved', 'Available']
|
The stage of the animal. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the |
TypeError
|
If the |