diff options
author | jcass <john.cass77@gmail.com> | 2015-12-22 08:33:41 +0200 |
---|---|---|
committer | jcass <john.cass77@gmail.com> | 2015-12-22 08:33:41 +0200 |
commit | 1ed6b260da26597034c41681cb4f7c1933988d96 (patch) | |
tree | c56fd315afb60823208a3226c6d296e635fe45de /pandora | |
parent | c483045d9cd83cf431b60dcd450547cc6208710f (diff) | |
download | pydora-1ed6b260da26597034c41681cb4f7c1933988d96.tar.bz2 pydora-1ed6b260da26597034c41681cb4f7c1933988d96.tar.xz pydora-1ed6b260da26597034c41681cb4f7c1933988d96.zip |
Move validation check to be performed before expensive network call.
Diffstat (limited to 'pandora')
-rw-r--r-- | pandora/client.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/pandora/client.py b/pandora/client.py index 6e6bab0..a11f14c 100644 --- a/pandora/client.py +++ b/pandora/client.py | |||
@@ -260,12 +260,11 @@ class APIClient(BaseAPIClient): | |||
260 | 260 | ||
261 | def get_ad_item(self, station_id, ad_token): | 261 | def get_ad_item(self, station_id, ad_token): |
262 | from .models.pandora import AdItem | 262 | from .models.pandora import AdItem |
263 | |||
264 | ad_metadata = self.get_ad_metadata(ad_token) | ||
265 | if not station_id: | 263 | if not station_id: |
266 | raise ValueError("The 'station_id' param must be defined, " | 264 | raise ValueError("The 'station_id' param must be defined, " |
267 | "got: '%s'" % station_id) | 265 | "got: '%s'" % station_id) |
268 | 266 | ||
267 | ad_metadata = self.get_ad_metadata(ad_token) | ||
269 | ad_metadata["stationId"] = station_id | 268 | ad_metadata["stationId"] = station_id |
270 | 269 | ||
271 | return AdItem.from_json(self, ad_metadata) | 270 | return AdItem.from_json(self, ad_metadata) |