コード例 #1
0
    def get(self):

        if self.request.host.startswith('api.') or 'spec' in self.request.uri:

            html = self.get_argument('html', default=False)

            applist = get_api_specification(self)

            if html:
                self.render('apisvctemplate.html', items=json.loads(applist))
                return

            self.write(applist)
        else:
            self.write("<h1>Hello! You're doing well</h1>")
コード例 #2
0
ファイル: comm.py プロジェクト: djorovic/BASE
    def get(self):

        if self.request.host.startswith('api.') or 'spec' in self.request.uri:

            html = self.get_argument('html', default=False)

            applist = get_api_specification(self)

            if html:
                self.render('apisvctemplate.html', items=json.loads(applist))
                return

            self.write(applist)
        else:
            self.write("<h1>Hello! You're doing well</h1>")
コード例 #3
0
ファイル: comm.py プロジェクト: ivanjankoviic/BASE
    def get(self):

        if self.request.host.startswith('api.') or 'spec' in self.request.uri:

            html = self.get_argument('html', default=False)

            applist = get_api_specification(self)

            if html:
                j = json.loads(applist)

                base = None
                app = None

                for base_key in j['applications'].keys():
                    if base_key == 'BASE':
                        base = j['applications']['BASE']
                        version = j['api_version']
                        base_ordered = list(base.keys())
                        base_ordered.sort()

                    else:
                        app = j['applications'][base_key]

                        app_ordered = list(app.keys())
                        app_ordered.sort()

                        _name = base_key
                        version = app[
                            'APP_VERSION'] if 'APP_VERSION' in app else ''

                self.render('apisvctemplate.html',
                            items=[{
                                'name': 'BASE',
                                'data': base,
                                'order': base_ordered,
                                'version': version
                            }, {
                                'name': _name,
                                'data': app,
                                'order': app_ordered,
                                'version': version
                            }])
                return

            self.write(applist)
        else:
            self.write("<h1>Hello! You're doing well</h1>")
コード例 #4
0
ファイル: comm.py プロジェクト: elektrobata/BASE
    def get(self):

        if self.request.host.startswith('api.') or 'spec' in self.request.uri:

            html = self.get_argument('html', default=False)

            applist = get_api_specification(self)

            if html:
                j = json.loads(applist);

                base = None
                app = None

                for base_key in j['applications'].keys():
                    if base_key == 'BASE':
                        base = j['applications']['BASE']
                        version = j['api_version']
                        base_ordered = list(base.keys())
                        base_ordered .sort()

                    else:
                        app = j['applications'][base_key]

                        app_ordered = list(app.keys())
                        app_ordered.sort()

                        _name = base_key
                        version = app['APP_VERSION'] if 'APP_VERSION' in app else ''


                self.render('apisvctemplate.html', items=[{'name': 'BASE',
                                              'data': base,
                                              'order': base_ordered,
                                              'version': version},
                                             {'name': _name,
                                              'data': app,
                                              'order': app_ordered,
                                              'version': version}])
                return

            self.write(applist)
        else:
            self.write("<h1>Hello! You're doing well</h1>")