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
8e8f2616
Verified
Commit
8e8f2616
authored
1 year ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Fix CSV status string
parent
7ab73551
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
metobsapi/data_api.py
+5
-2
5 additions, 2 deletions
metobsapi/data_api.py
metobsapi/tests/test_data_api.py
+8
-0
8 additions, 0 deletions
metobsapi/tests/test_data_api.py
with
13 additions
and
2 deletions
metobsapi/data_api.py
+
5
−
2
View file @
8e8f2616
...
...
@@ -196,7 +196,7 @@ def handle_csv(frame, epoch, response_info, formatting_kwargs):
output
=
output
.
format
(
sep
=
sep
,
status
=
response_info
.
get
(
"
status
_info
"
,
"
success
"
),
status
=
response_info
.
get
(
"
status
"
,
"
success
"
),
code
=
code
,
message
=
response_info
.
get
(
"
message
"
,
""
),
num_results
=
frame
.
shape
[
0
]
if
frame
is
not
None
else
0
,
...
...
@@ -432,7 +432,10 @@ def _query_time_series_db(time_parameters, influx_symbols):
try
:
result
=
query
(
influx_symbols
,
*
time_parameters
)
except
ReadTimeoutError
:
message
=
"
Request took too long to process. It may be too much data. Try a shorter time range.
"
message
=
(
"
Request took too long to process. It may be too much data.
"
"
Try a shorter time range or use files API.
"
)
code
=
413
status
=
"
fail
"
result
=
None
...
...
This diff is collapsed.
Click to expand it.
metobsapi/tests/test_data_api.py
+
8
−
0
View file @
8e8f2616
...
...
@@ -298,6 +298,14 @@ def test_too_many_points(client):
assert
res
[
"
status
"
]
==
"
fail
"
def
test_too_many_points_csv
(
client
):
res
=
client
.
get
(
"
/api/data.csv?symbols=aoss.tower.air_temp&begin=1970-01-01T00:00:00
"
)
assert
res
.
status_code
==
413
csv_data
=
res
.
data
.
decode
()
assert
"
status: fail
"
in
csv_data
assert
"
num_results: 0
"
in
csv_data
@pytest.mark.parametrize
(
(
"
begin
"
,
"
end
"
,
"
exp_query_time
"
),
[
...
...
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