Skip to content

Commit ca4441d

Browse files
committed
feat: first release
1 parent 11d4147 commit ca4441d

44 files changed

Lines changed: 78288 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎api/__init__.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
from python_framework.api.resource.swaggerui import *
3+
4+
from python_framework.api.src.annotation import MethodWrapper
5+
6+
from python_framework.api.src.domain import HttpStatus
7+
8+
from python_framework.api.src.model import ErrorLog
9+
10+
from python_framework.api.src.helper import Serializer
11+
12+
from python_framework.api.src.service.framework import GlobalException
13+
from python_framework.api.src.service.framework import Security
14+
from python_framework.api.src.service.framework import SqlAlchemyProxy
15+
16+
from python_framework.api.src.service.framework.openapi import OpenApiManager
17+
18+
from python_framework.api.src.service.framework.flask import FlaskManager
19+
from python_framework.api.src.service.framework.flask import ResourceManager

‎api/resource/Globals.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Globals:
2+
print-status: True
3+
api:
4+
name: FeatureManager
5+
host: localhost:5000 ###- feature-dataset-manager.herokuapp.com ###-
6+
schemes: [http] ###- [https] ###- [http, https] ###- [http] ###-
7+
info:
8+
title: Feature Manager
9+
version: 0.0.1
10+
description: This is an api that manage samples and its features. The main goal is to retrieve the best sample match given a set of features
11+
terms-of-service: http://swagger.io/terms/
12+
contact:
13+
name: Samuel Jansen
14+
email: samuel.jansenn@gmail.com
15+
license:
16+
name: Apache 2.0 / MIT License
17+
url: http://www.apache.org/licenses/LICENSE-2.0.html
18+
19+
extension: yml
20+
dependency:
21+
update: False
22+
list:
23+
web: [globals,python_helper,Popen,Path,numpy,pywin32,sqlalchemy]

‎api/resource/__init__.py‎

Whitespace-only changes.

‎api/resource/swaggerui/LICENSE‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright 2017 SmartBear Software
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6+
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.

‎api/resource/swaggerui/VERSION‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v3.25.0

‎api/resource/swaggerui/__init__.py‎

Whitespace-only changes.
665 Bytes
Loading
628 Bytes
Loading
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!-- HTML for static distribution bundle build -->
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>{{app_name}}</title>
7+
<link rel="stylesheet" type="text/css" href="{{base_url}}/swagger-ui.css" >
8+
<link rel="icon" type="image/png" href="{{base_url}}/favicon-32x32.png" sizes="32x32" />
9+
<link rel="icon" type="image/png" href="{{base_url}}/favicon-16x16.png" sizes="16x16" />
10+
<style>
11+
html
12+
{
13+
box-sizing: border-box;
14+
overflow: -moz-scrollbars-vertical;
15+
overflow-y: scroll;
16+
}
17+
18+
*,
19+
*:before,
20+
*:after
21+
{
22+
box-sizing: inherit;
23+
}
24+
25+
body
26+
{
27+
margin:0;
28+
background: #fafafa;
29+
}
30+
</style>
31+
</head>
32+
33+
<body>
34+
<div id="swagger-ui"></div>
35+
36+
<script src="{{base_url}}/swagger-ui-bundle.js"> </script>
37+
<script src="{{base_url}}/swagger-ui-standalone-preset.js"> </script>
38+
<script>
39+
var config = {
40+
presets: [
41+
SwaggerUIBundle.presets.apis,
42+
SwaggerUIStandalonePreset
43+
],
44+
plugins: [
45+
SwaggerUIBundle.plugins.DownloadUrl
46+
]
47+
};
48+
var user_config = {{config_json|safe}}; // User config options provided from Python code
49+
for (var attrname in user_config) { config[attrname] = user_config[attrname]; }
50+
51+
window.onload = function() {
52+
// Build a system
53+
const ui = SwaggerUIBundle(config)
54+
55+
{% if oauth_config_json %}
56+
var oauth_user_config = {{oauth_config_json|safe}}; // OAuth2 user config options provided from Python code
57+
ui.initOAuth(oauth_user_config);
58+
{% endif %}
59+
60+
window.ui = ui
61+
}
62+
</script>
63+
</body>
64+
</html>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<title>Swagger UI: OAuth2 Redirect</title>
4+
<body onload="run()">
5+
</body>
6+
</html>
7+
<script>
8+
'use strict';
9+
function run () {
10+
var oauth2 = window.opener.swaggerUIRedirectOauth2;
11+
var sentState = oauth2.state;
12+
var redirectUrl = oauth2.redirectUrl;
13+
var isValid, qp, arr;
14+
15+
if (/code|token|error/.test(window.location.hash)) {
16+
qp = window.location.hash.substring(1);
17+
} else {
18+
qp = location.search.substring(1);
19+
}
20+
21+
arr = qp.split("&")
22+
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
23+
qp = qp ? JSON.parse('{' + arr.join() + '}',
24+
function (key, value) {
25+
return key === "" ? value : decodeURIComponent(value)
26+
}
27+
) : {}
28+
29+
isValid = qp.state === sentState
30+
31+
if ((
32+
oauth2.auth.schema.get("flow") === "accessCode"||
33+
oauth2.auth.schema.get("flow") === "authorizationCode"
34+
) && !oauth2.auth.code) {
35+
if (!isValid) {
36+
oauth2.errCb({
37+
authId: oauth2.auth.name,
38+
source: "auth",
39+
level: "warning",
40+
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
41+
});
42+
}
43+
44+
if (qp.code) {
45+
delete oauth2.state;
46+
oauth2.auth.code = qp.code;
47+
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
48+
} else {
49+
let oauthErrorMsg
50+
if (qp.error) {
51+
oauthErrorMsg = "["+qp.error+"]: " +
52+
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
53+
(qp.error_uri ? "More info: "+qp.error_uri : "");
54+
}
55+
56+
oauth2.errCb({
57+
authId: oauth2.auth.name,
58+
source: "auth",
59+
level: "error",
60+
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
61+
});
62+
}
63+
} else {
64+
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
65+
}
66+
window.close();
67+
}
68+
</script>

0 commit comments

Comments
 (0)