Skip to content

Commit fdd9ba1

Browse files
author
Jonny Johannes
committed
params key
1 parent e9865c2 commit fdd9ba1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

adoption_sources/rescue_groups.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def fetch_pets(self) -> Iterator[AdoptablePet]:
6565
"Set CUTEPETSBOSTON_RESCUEGROUPS_API_KEY environment variable."
6666
)
6767

68-
query_url_params = {
68+
params = {
6969
'limit': self.limit,
7070
'sort': 'random'
7171
}
@@ -84,8 +84,7 @@ def fetch_pets(self) -> Iterator[AdoptablePet]:
8484
# },
8585
},
8686
}
87-
query_string = urlencode(query_url_params)
88-
url = f"{self.BASE_URL}/{self.species}/?{query_string}"
87+
url = f"{self.BASE_URL}/{self.species}/"
8988
headers = {
9089
"Content-Type": "application/vnd.api+json",
9190
"Authorization": self._api_key,
@@ -95,7 +94,13 @@ def fetch_pets(self) -> Iterator[AdoptablePet]:
9594
f"Fetching {self.species} from RescueGroups within {self.radius_miles} miles of {self.postal_code}"
9695
)
9796

98-
response = requests.post(url, json=payload, headers=headers, timeout=30)
97+
response = requests.post(
98+
url,
99+
params=params,
100+
json=payload,
101+
headers=headers,
102+
timeout=30
103+
)
99104
response.raise_for_status()
100105

101106
data = response.json().get("data", [])

0 commit comments

Comments
 (0)