pybarb 0.4__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pybarb-0.4 → pybarb-0.4.2}/PKG-INFO +1 -1
- {pybarb-0.4 → pybarb-0.4.2}/pybarb/pybarb.py +13 -13
- {pybarb-0.4 → pybarb-0.4.2}/pybarb.egg-info/PKG-INFO +1 -1
- {pybarb-0.4 → pybarb-0.4.2}/setup.py +1 -1
- {pybarb-0.4 → pybarb-0.4.2}/README.md +0 -0
- {pybarb-0.4 → pybarb-0.4.2}/pybarb/__init__.py +0 -0
- {pybarb-0.4 → pybarb-0.4.2}/pybarb.egg-info/SOURCES.txt +0 -0
- {pybarb-0.4 → pybarb-0.4.2}/pybarb.egg-info/dependency_links.txt +0 -0
- {pybarb-0.4 → pybarb-0.4.2}/pybarb.egg-info/requires.txt +0 -0
- {pybarb-0.4 → pybarb-0.4.2}/pybarb.egg-info/top_level.txt +0 -0
- {pybarb-0.4 → pybarb-0.4.2}/setup.cfg +0 -0
|
@@ -131,7 +131,7 @@ class BarbAPI:
|
|
|
131
131
|
else:
|
|
132
132
|
raise Exception(f"Panel name {panel_region} not found.")
|
|
133
133
|
return panel_code
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
def programme_ratings(self, min_transmission_date, max_transmission_date, station=None, panel=None, consolidated=True, last_updated_greater_than=None, use_reporting_days=True, limit=5000):
|
|
136
136
|
"""
|
|
137
137
|
Gets the programme ratings for a given date range.
|
|
@@ -280,7 +280,7 @@ class BarbAPI:
|
|
|
280
280
|
api_url = f"{self.api_root}{endpoint}"
|
|
281
281
|
r = requests.get(url=api_url, params=parameters, headers=self.headers)
|
|
282
282
|
r_json = r.json()
|
|
283
|
-
api_response_data = {"endpoint":
|
|
283
|
+
api_response_data = {"endpoint": endpoint,
|
|
284
284
|
"events": r_json["events"],
|
|
285
285
|
"audience_categories": r_json["audience_categories"]}
|
|
286
286
|
while r.headers.__contains__("X-Next"):
|
|
@@ -308,7 +308,7 @@ class BarbAPI:
|
|
|
308
308
|
|
|
309
309
|
if regex_filter is not None:
|
|
310
310
|
|
|
311
|
-
regex = re.compile(regex_filter)
|
|
311
|
+
regex = re.compile(regex_filter, flags=re.IGNORECASE)
|
|
312
312
|
list_of_stations = list(filter(regex.search, list_of_stations))
|
|
313
313
|
|
|
314
314
|
return list_of_stations
|
|
@@ -329,7 +329,7 @@ class BarbAPI:
|
|
|
329
329
|
|
|
330
330
|
if regex_filter is not None:
|
|
331
331
|
|
|
332
|
-
regex = re.compile(regex_filter)
|
|
332
|
+
regex = re.compile(regex_filter, flags=re.IGNORECASE)
|
|
333
333
|
list_of_stations = list(filter(regex.search, list_of_stations))
|
|
334
334
|
|
|
335
335
|
return list_of_stations
|
|
@@ -349,7 +349,7 @@ class BarbAPI:
|
|
|
349
349
|
|
|
350
350
|
if regex_filter is not None:
|
|
351
351
|
|
|
352
|
-
regex = re.compile(regex_filter)
|
|
352
|
+
regex = re.compile(regex_filter, flags=re.IGNORECASE)
|
|
353
353
|
list_of_panels = list(filter(regex.search, list_of_panels))
|
|
354
354
|
|
|
355
355
|
return list_of_panels
|
|
@@ -369,7 +369,7 @@ class BarbAPI:
|
|
|
369
369
|
|
|
370
370
|
if regex_filter is not None:
|
|
371
371
|
|
|
372
|
-
regex = re.compile(regex_filter)
|
|
372
|
+
regex = re.compile(regex_filter, flags=re.IGNORECASE)
|
|
373
373
|
list_of_buyers = list(filter(regex.search, list_of_buyers))
|
|
374
374
|
|
|
375
375
|
return list_of_buyers
|
|
@@ -382,15 +382,15 @@ class BarbAPI:
|
|
|
382
382
|
list: The advertisers result set.
|
|
383
383
|
"""
|
|
384
384
|
|
|
385
|
-
api_url = f"{self.api_root}
|
|
385
|
+
api_url = f"{self.api_root}advertisers"
|
|
386
386
|
api_response_data = requests.get(url=api_url, headers=self.headers)
|
|
387
387
|
|
|
388
|
-
list_of_advertisers = api_response_data.json()
|
|
388
|
+
list_of_advertisers = [a['advertiser_name'] for a in api_response_data.json()]
|
|
389
389
|
|
|
390
390
|
if regex_filter is not None:
|
|
391
391
|
|
|
392
|
-
regex = re.compile(regex_filter)
|
|
393
|
-
|
|
392
|
+
regex = re.compile(regex_filter, flags=re.IGNORECASE)
|
|
393
|
+
list_of_advertisers = list(filter(regex.search, list_of_advertisers))
|
|
394
394
|
|
|
395
395
|
return list_of_advertisers
|
|
396
396
|
|
|
@@ -618,9 +618,9 @@ class ProgrammeRatingsResultSet(APIResultSet):
|
|
|
618
618
|
'uk_premiere': e['uk_premier'],
|
|
619
619
|
'broadcaster_premiere': e['broadcaster_premier'],
|
|
620
620
|
'programme_repeat': e['repeat'],
|
|
621
|
-
'episode_number': e['episode']['episode_number'] if 'episode' in e else None,
|
|
622
|
-
'episode_name': e['episode']['episode_name'] if 'episode' in e else None,
|
|
623
|
-
'genre': e['genre'] if 'genre' in e else None,
|
|
621
|
+
'episode_number': e['programme_content']['episode']['episode_number'] if 'episode' in e['programme_content'].keys() else None,
|
|
622
|
+
'episode_name': e['programme_content']['episode']['episode_name'] if 'episode' in e['programme_content'].keys() else None,
|
|
623
|
+
'genre': e['programme_content']['genre'] if 'genre' in e['programme_content'].keys() else None,
|
|
624
624
|
'audience_code': v['audience_code'],
|
|
625
625
|
'audience_size_hundreds': v['audience_size_hundreds']})
|
|
626
626
|
# Convert the result into a data frame
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|