#!/usr/bin/python
# -*- coding:utf-8 -*-

import requests

from pydashie.dashie_sampler import DashieSampler


class BackstageStoreVersions(DashieSampler):
    def name(self):
        return 'backstage-store-versions'

    def sample(self):
        data = [
            ('QA', 'http://api.store-qa.backstage.globoi.com/api/version/'),
            ('Prod', 'http://api.store.backstage.globoi.com/api/version/'),
        ]

        items = []
        for label, url in data:
            resp = requests.get(url)
            try:
                version = resp.json().get('version', '')
            except:
                version = ''
            items.append({'label': label, 'value': version})

        return {'items': items}

@@ -267,16 +267,20 @@
     ('QA
+-API
 ', 'http
@@ -324,32 +324,104 @@
 api/version/'),%0A
+            ('QA-Web', 'http://store-qa.backstage.globoi.com/version'),%0A
             ('Pr
@@ -422,16 +422,20 @@
   ('Prod
+-API
 ', 'http
@@ -476,32 +476,103 @@
 api/version/'),%0A
+            ('Prod-Web', 'http://store.backstage.globoi.com/version'),%0A
         %5D%0A%0A     

Store Versions: Added Web