| |
@@ -53,26 +53,30 @@
|
| |
url = bodhiurl + query
|
| |
headers = {'Accept': 'application/json'}
|
| |
response = requests.get(url, headers=headers)
|
| |
- data = response.json()
|
| |
-
|
| |
- # Limit it this to only the updates that haven't already requested stable
|
| |
- # but which can actually be pushed to stable now.
|
| |
- data['updates'] = [
|
| |
- update for update in data['updates']
|
| |
- if update['request'] is None and
|
| |
- any([giveaway in comment['text'] for comment in update['comments']])
|
| |
- ]
|
| |
-
|
| |
- # Stuff some useful information in there.
|
| |
- baseurl = 'https://apps.fedoraproject.org/packages/images/icons/'
|
| |
- for update in data['updates']:
|
| |
- build = update['builds'][0]
|
| |
- nvr = build['nvr']
|
| |
- package = parse_nvr(nvr)
|
| |
- update['icon'] = baseurl + package[0] + '.png'
|
| |
- update['link'] = bodhiurl + update['title']
|
| |
-
|
| |
- return data
|
| |
+ if response.status_code == 200:
|
| |
+ data = response.json()
|
| |
+
|
| |
+ # Limit it this to only the updates that haven't already requested stable
|
| |
+ # but which can actually be pushed to stable now.
|
| |
+ data['updates'] = [
|
| |
+ update for update in data['updates']
|
| |
+ if update['request'] is None and
|
| |
+ any([giveaway in comment['text'] for comment in update['comments']])
|
| |
+ ]
|
| |
+
|
| |
+ # Stuff some useful information in there.
|
| |
+ baseurl = 'https://apps.fedoraproject.org/packages/images/icons/'
|
| |
+ for update in data['updates']:
|
| |
+ build = update['builds'][0]
|
| |
+ nvr = build['nvr']
|
| |
+ package = parse_nvr(nvr)
|
| |
+ update['icon'] = baseurl + package[0] + '.png'
|
| |
+ update['link'] = bodhiurl + update['title']
|
| |
+
|
| |
+ return data
|
| |
+ else:
|
| |
+ data = {}
|
| |
+ return data
|
| |
|
| |
|
| |
def parse_nvr(nvr):
|
| |
Here you can do a simple:
if response
if that response is a requests request object.