Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetObsAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
MetObsAPI
Commits
25b3ec2b
Commit
25b3ec2b
authored
9 years ago
by
Kenny Gao
Browse files
Options
Downloads
Patches
Plain Diff
CORS now operational
parent
82be8476
No related branches found
No related tags found
1 merge request
!2
Order form
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
metobsapi/.DS_Store
+0
-0
0 additions, 0 deletions
metobsapi/.DS_Store
metobsapi/modifyData.py
+6
-2
6 additions, 2 deletions
metobsapi/modifyData.py
metobsapi/multiData.py
+5
-1
5 additions, 1 deletion
metobsapi/multiData.py
metobsapi/server.py
+3
-1
3 additions, 1 deletion
metobsapi/server.py
with
14 additions
and
4 deletions
metobsapi/.DS_Store
+
0
−
0
View file @
25b3ec2b
No preview for this file type
This diff is collapsed.
Click to expand it.
metobsapi/modifyData.py
+
6
−
2
View file @
25b3ec2b
...
@@ -259,7 +259,11 @@ def jsonReturn(frame, symbols, site, inst, jsonFormat, epoch):
...
@@ -259,7 +259,11 @@ def jsonReturn(frame, symbols, site, inst, jsonFormat, epoch):
newRow
=
[]
newRow
=
[]
for
symbol
in
symbols
:
for
symbol
in
symbols
:
newRow
.
append
(
row
[
symbol
])
if
(
row
[
symbol
]):
newRow
.
append
(
float
(
row
[
symbol
]))
else
:
newRow
.
append
(
row
[
symbol
])
dataList
.
append
(
newRow
)
dataList
.
append
(
newRow
)
...
@@ -401,7 +405,7 @@ def handleResult(fmt, result, symbols, interval, sep, spd, wDir):
...
@@ -401,7 +405,7 @@ def handleResult(fmt, result, symbols, interval, sep, spd, wDir):
direction
[
row
]
=
0
direction
[
row
]
=
0
elif
(
wEast
[
row
]
==
0
):
elif
(
wEast
[
row
]
==
0
):
if
(
wNorth
>
0
):
if
(
wNorth
[
row
]
>
0
):
direction
[
row
]
=
0
direction
[
row
]
=
0
else
:
else
:
direction
[
row
]
=
180
direction
[
row
]
=
180
...
...
This diff is collapsed.
Click to expand it.
metobsapi/multiData.py
+
5
−
1
View file @
25b3ec2b
...
@@ -189,7 +189,11 @@ def jsonReturn(frame, symbols, jsonFormat, epoch):
...
@@ -189,7 +189,11 @@ def jsonReturn(frame, symbols, jsonFormat, epoch):
newRow
=
[]
newRow
=
[]
for
symbol
in
symbols
:
for
symbol
in
symbols
:
newRow
.
append
(
row
[
symbol
])
if
(
row
[
symbol
]):
newRow
.
append
(
float
(
row
[
symbol
]))
else
:
newRow
.
append
(
row
[
symbol
])
dataList
.
append
(
newRow
)
dataList
.
append
(
newRow
)
...
...
This diff is collapsed.
Click to expand it.
metobsapi/server.py
+
3
−
1
View file @
25b3ec2b
#might have to restart from scratch again
#might have to restart from scratch again
from
flask
import
Flask
,
render_template
,
request
,
jsonify
,
Response
from
flask
import
Flask
,
render_template
,
request
,
jsonify
,
Response
from
flask_cors
import
CORS
,
cross_origin
from
flask_json
import
FlaskJSON
,
as_json_p
from
flask_json
import
FlaskJSON
,
as_json_p
import
Util
import
Util
import
modifyData
import
modifyData
...
@@ -13,6 +14,7 @@ app = Flask(__name__)
...
@@ -13,6 +14,7 @@ app = Flask(__name__)
app
.
config
[
'
SECRET_KEY
'
]
=
'
secret!
'
app
.
config
[
'
SECRET_KEY
'
]
=
'
secret!
'
app
.
config
[
'
JSONIFY_PRETTYPRINT_REGULAR
'
]
=
False
app
.
config
[
'
JSONIFY_PRETTYPRINT_REGULAR
'
]
=
False
json
=
FlaskJSON
(
app
)
json
=
FlaskJSON
(
app
)
CORS
(
app
,
resources
=
r
'
/api/*
'
,
allow_headers
=
'
Content-Type
'
)
def
handleIntError
(
statusNo
,
fmt
):
def
handleIntError
(
statusNo
,
fmt
):
if
(
statusNo
==
500
):
if
(
statusNo
==
500
):
...
@@ -219,7 +221,7 @@ def page_not_found(e):
...
@@ -219,7 +221,7 @@ def page_not_found(e):
def
internal_server
(
e
):
def
internal_server
(
e
):
return
render_template
(
'
500.html
'
),
500
return
render_template
(
'
500.html
'
),
500
@app.route
(
'
/api/data.<fmt>
'
)
@app.route
(
'
/api/data.<fmt>
'
,
methods
=
[
'
GET
'
]
)
def
test
(
fmt
):
def
test
(
fmt
):
sites
=
request
.
args
.
get
(
'
site
'
)
sites
=
request
.
args
.
get
(
'
site
'
)
inst
=
request
.
args
.
get
(
'
inst
'
)
inst
=
request
.
args
.
get
(
'
inst
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment