Esempio n. 1
0
 def get(self, release, platform, locale):
     try:
         locale = dbo.releases.getLocale(release, platform, locale)
     except KeyError as e:
         return problem(404, "Not Found", json.dumps(e.args))
     data_version = dbo.releases.getReleases(name=release)[0]['data_version']
     headers = {'X-Data-Version': data_version}
     headers.update(get_csrf_headers())
     return Response(response=json.dumps(locale), mimetype='application/json', headers=headers)
Esempio n. 2
0
 def get(self, release, platform, locale):
     try:
         locale = dbo.releases.getLocale(release, platform, locale)
     except KeyError as e:
         return problem(404, "Not Found", json.dumps(e.args))
     data_version = dbo.releases.getReleases(
         name=release)[0]['data_version']
     headers = {'X-Data-Version': data_version}
     headers.update(get_csrf_headers())
     return Response(response=json.dumps(locale),
                     mimetype='application/json',
                     headers=headers)
Esempio n. 3
0
    def get(self, id_or_alias):
        rule = dbo.rules.getRule(id_or_alias)
        if not rule:
            return Response(status=404,
                            response="Requested rule does not exist")

        headers = {'X-Data-Version': rule['data_version']}
        headers.update(get_csrf_headers())

        return Response(response=json.dumps(rule),
                        mimetype="application/json",
                        headers=headers)
Esempio n. 4
0
 def get(self, release):
     release = dbo.releases.getReleases(name=release, limit=1)
     if not release:
         return problem(404, "Not Found", "Release name: %s not found" % release)
     headers = {'X-Data-Version': release[0]['data_version']}
     headers.update(get_csrf_headers())
     if connexion.request.args.get("pretty"):
         indent = 4
     else:
         indent = None
     return Response(response=json.dumps(release[0]['data'], indent=indent, sort_keys=True),
                     mimetype='application/json', headers=headers)
Esempio n. 5
0
    def get(self, id_or_alias):
        rule = dbo.rules.getRule(id_or_alias)
        if not rule:
            return problem(status=404,
                           title="Not Found",
                           detail="Requested rule wasn't found",
                           ext={"exception": "Requested rule does not exist"})

        headers = {'X-Data-Version': rule['data_version']}
        headers.update(get_csrf_headers())

        return Response(response=json.dumps(rule),
                        mimetype="application/json",
                        headers=headers)
Esempio n. 6
0
 def get(self, release):
     release = dbo.releases.getReleases(name=release, limit=1)
     if not release:
         return Response(status=404, mimetype="application/json")
     headers = {'X-Data-Version': release[0]['data_version']}
     headers.update(get_csrf_headers())
     if request.args.get("pretty"):
         indent = 4
     else:
         indent = None
     return Response(response=json.dumps(release[0]['data'],
                                         indent=indent,
                                         sort_keys=True),
                     mimetype='application/json',
                     headers=headers)
Esempio n. 7
0
 def get(self, release):
     release = dbo.releases.getReleases(name=release, limit=1)
     if not release:
         return problem(404, "Not Found",
                        "Release name: %s not found" % release)
     headers = {'X-Data-Version': release[0]['data_version']}
     headers.update(get_csrf_headers())
     if connexion.request.args.get("pretty"):
         indent = 4
     else:
         indent = None
     return Response(response=json.dumps(release[0]['data'],
                                         indent=indent,
                                         sort_keys=True),
                     mimetype='application/json',
                     headers=headers)