Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
ec4ebbd
init endpoint files
akash5100 Jul 3, 2022
f2312e4
Parameterized the tests
akash5100 Jul 4, 2022
e08ec9e
test and base class for getJP2Header endpoint
akash5100 Jul 4, 2022
a8760e9
Add JPX endpoint
akash5100 Jul 4, 2022
c30d46c
Add getStatus endpoint
akash5100 Jul 4, 2022
58fb40d
Add closest to midpoint endpoint
akash5100 Jul 4, 2022
62f315b
replace time with datetime module to create timestamps
akash5100 Jul 5, 2022
94acba8
Replace Field with Optional
akash5100 Jul 5, 2022
0bfb6f4
revert the test
akash5100 Jul 5, 2022
b555d31
Remove test for unknown/invalid args
akash5100 Jul 5, 2022
ddf4390
Split Parameterized to multiple tests
akash5100 Jul 5, 2022
feb01bd
Split Parameterized to multiple tests
akash5100 Jul 5, 2022
61266b4
Revert changes to avoid merge conflict
akash5100 Jul 6, 2022
f8f4e0d
Fix repeating convert_date_to_isoformat function
akash5100 Jul 6, 2022
94be257
fix failing test
akash5100 Jul 6, 2022
df99124
enable reuse
nabobalis Jul 7, 2022
922c64e
init endpoint files
akash5100 Jul 3, 2022
98408fa
test and base class for getJP2Header endpoint
akash5100 Jul 4, 2022
b31f8f3
Add JPX endpoint
akash5100 Jul 4, 2022
c4d40eb
Add getStatus endpoint
akash5100 Jul 4, 2022
5e82f16
Add closest to midpoint endpoint
akash5100 Jul 4, 2022
c6eb20a
replace time with datetime module to create timestamps
akash5100 Jul 5, 2022
93ad96e
Replace Field with Optional
akash5100 Jul 5, 2022
a0793de
Remove test for unknown/invalid args
akash5100 Jul 5, 2022
021d4eb
Split Parameterized to multiple tests
akash5100 Jul 5, 2022
9ea7720
Split Parameterized to multiple tests
akash5100 Jul 5, 2022
d23e1fa
Revert changes to avoid merge conflict
akash5100 Jul 6, 2022
e0b6ab7
Fix repeating convert_date_to_isoformat function
akash5100 Jul 6, 2022
5c025c2
fix failing test
akash5100 Jul 6, 2022
6311073
enable reuse
nabobalis Jul 7, 2022
07dcf57
Merge branch 'main' into jpeg2000_endpoints
akash5100 Jul 8, 2022
81ed5d1
Remove test for unknown paramters
akash5100 Jul 8, 2022
a0e9a81
Merge branch 'jpeg2000_endpoints' of github.com:akash5100/python-api …
akash5100 Jul 8, 2022
1058cd1
Update hvpy/api_groups/jpeg2000/get_jpx.py
akash5100 Jul 8, 2022
c7d1bbd
Update hvpy/api_groups/jpeg2000/get_jpx_closest_to_mid_point.py
akash5100 Jul 8, 2022
32fde97
Merge branch 'Helioviewer-Project:main' into jpeg2000_endpoints
akash5100 Jul 11, 2022
5e1bb39
Update docstring for automodapi
akash5100 Jul 11, 2022
809387a
bring all endpoints to facade
akash5100 Jul 11, 2022
a8532bb
facade functions for jpeg2000 endpoints
akash5100 Jul 11, 2022
bfd6555
Fix 2/3 failing tests
akash5100 Jul 11, 2022
1aed748
Fix getJP2Header test
akash5100 Jul 11, 2022
f300e1c
Refactor tests
akash5100 Jul 11, 2022
ef212ed
Change imports
akash5100 Jul 11, 2022
480ca0d
Fix for the failing doc tests
akash5100 Jul 11, 2022
f5418fd
Update hvpy/facade.py
akash5100 Jul 11, 2022
87b5909
Update hvpy/api_groups/jpeg2000/tests/test_get_jpx.py
akash5100 Jul 11, 2022
987fb9c
Fix for the failing doc tests
akash5100 Jul 11, 2022
2b9e524
Merge branch 'jpeg2000_endpoints' of github.com:akash5100/python-api …
akash5100 Jul 11, 2022
dec0ffd
Update hvpy/facade.py
akash5100 Jul 11, 2022
9d82e6f
Update hvpy/facade.py
akash5100 Jul 11, 2022
b718214
truncade the example for getStatus
akash5100 Jul 11, 2022
d0b3c06
Merge branch 'jpeg2000_endpoints' of github.com:akash5100/python-api …
akash5100 Jul 11, 2022
4afbb13
Update hvpy/facade.py
akash5100 Jul 11, 2022
5c118eb
fix getJPXClosestToMidPoint doc error
akash5100 Jul 11, 2022
42bb5f5
Merge branch 'jpeg2000_endpoints' of github.com:akash5100/python-api …
akash5100 Jul 11, 2022
dbc3c29
Fixed doctest
akash5100 Jul 12, 2022
272fca4
Fixed doctest
akash5100 Jul 12, 2022
953ce3f
Fix doc_build
akash5100 Jul 12, 2022
dcdb89c
Update examples
akash5100 Jul 13, 2022
8b8d069
fix for failing docs build
akash5100 Jul 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hvpy/api_groups/jpeg2000/get_jp2_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class getJP2HeaderInputParameters(HvpyParameters):

Attributes
----------
{Shared}
id : int
Unique JP2 image identifier.
callback : str, optional
Expand All @@ -17,6 +18,7 @@ class getJP2HeaderInputParameters(HvpyParameters):
References
----------
* `<https://api.helioviewer.org/docs/v2/api/api_groups/jpeg2000.html#getjp2header>`__
{Shared}
"""

id: int
Expand Down
2 changes: 1 addition & 1 deletion hvpy/api_groups/jpeg2000/get_jp2_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class getJP2ImageInputParameters(HvpyParameters):
"""
Handles the input parameters of the getJP2Image API.

{Shared}
Attributes
----------
{Shared}
date : datetime.datetime
Desired date/time of the JP2 image.
sourceId : int
Expand Down
6 changes: 4 additions & 2 deletions hvpy/api_groups/jpeg2000/get_jpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ class getJPXInputParameters(HvpyParameters):

Attributes
----------
startTime : datetime
{Shared}
startTime : datetime.datetime
Date/Time for the beginning of the JPX movie data.
endTime : datetime
endTime : datetime.datetime
Date/Time for the end of the JPX movie data.
sourceId : int
Unique image datasource identifier.
Expand All @@ -31,6 +32,7 @@ class getJPXInputParameters(HvpyParameters):
References
----------
* `<https://api.helioviewer.org/docs/v2/api/api_groups/jpeg2000.html#getjpx>`__
{Shared}
"""

startTime: datetime
Expand Down
6 changes: 4 additions & 2 deletions hvpy/api_groups/jpeg2000/get_jpx_closest_to_mid_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ class getJPXClosestToMidPointInputParameters(HvpyParameters):

Attributes
----------
startTimes : datetime
{Shared}
startTimes : datetime.datetime
Comma separated timestamps for the beginning of the JPX movie data.
endTimes : datetime
endTimes : datetime.datetime
Comma separated timestamps for the end of the JPX movie data.
sourceId : int
Unique image datasource identifier.
Expand All @@ -29,6 +30,7 @@ class getJPXClosestToMidPointInputParameters(HvpyParameters):
References
----------
* `<https://api.helioviewer.org/docs/v2/api/api_groups/jpeg2000.html#getjpxclosesttomidpoint>`__
{Shared}
"""

startTimes: List[datetime]
Expand Down
5 changes: 3 additions & 2 deletions hvpy/api_groups/jpeg2000/get_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

class getStatusInputParameters(HvpyParameters):
"""
Returns information about how far behind the latest available JPEG2000
images.
handles the input parameters of the getStatus API.

{Shared}
References
----------
* `<https://api.helioviewer.org/docs/v2/api/api_groups/jpeg2000.html#getstatus>`__
{Shared}
"""

def get_output_type(self) -> OutputType:
Expand Down
13 changes: 5 additions & 8 deletions hvpy/api_groups/jpeg2000/tests/test_get_jp2_header.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
import pytest
from pydantic import ValidationError

from hvpy import getJP2Header
from hvpy.api_groups.jpeg2000.get_jp2_header import getJP2HeaderInputParameters
from hvpy.core import execute_api_call


def test_getJP2HeaderInputParameters():
params = getJP2HeaderInputParameters(id=9838343)
response = execute_api_call(input_parameters=params)
response = getJP2Header(id=9838343)
assert isinstance(response, str)
assert response.startswith("<?xml")
assert response.endswith("</meta>")

params = getJP2HeaderInputParameters(id=9838343, callback="my_callback")
response = execute_api_call(input_parameters=params)
response = getJP2Header(id=9838343, callback="my_callback")
assert isinstance(response, str)
assert response.startswith("my_callback(")


def test_error_handling():
with pytest.raises(ValidationError, match="getJP2HeaderInputParameters\nid\n field required"):
getJP2HeaderInputParameters(callback="my_callback")
with pytest.raises(TypeError, match="missing 1 required positional argument: 'id'"):
getJP2Header(callback="my_callback")


def test_url_property():
Expand Down
29 changes: 11 additions & 18 deletions hvpy/api_groups/jpeg2000/tests/test_get_jpx.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from datetime import datetime

import pytest
from pydantic import ValidationError

from hvpy import getJPX
from hvpy.api_groups.jpeg2000.get_jpx import getJPXInputParameters
from hvpy.core import execute_api_call


def test_raw_response():
params = getJPXInputParameters(
response = getJPX(
startTime=datetime(2014, 1, 1, 0, 0, 0),
endTime=datetime(2014, 1, 1, 0, 45, 0),
sourceId=14,
Expand All @@ -17,12 +16,11 @@ def test_raw_response():
jpip=False,
cadence=None,
)
response = execute_api_call(params)
assert isinstance(response, bytes)


def test_str_response():
params = getJPXInputParameters(
response = getJPX(
startTime=datetime(2014, 1, 1, 0, 0, 0),
endTime=datetime(2014, 1, 1, 0, 45, 0),
sourceId=14,
Expand All @@ -31,13 +29,12 @@ def test_str_response():
jpip=True,
cadence=None,
)
response = execute_api_call(params)
assert isinstance(response, str)
assert response.startswith("jpip://")


def test_json_response():
params = getJPXInputParameters(
response = getJPX(
startTime=datetime(2014, 1, 1, 0, 0, 0),
endTime=datetime(2014, 1, 1, 0, 45, 0),
sourceId=14,
Expand All @@ -46,11 +43,10 @@ def test_json_response():
jpip=True,
cadence=None,
)
response = execute_api_call(params)
assert isinstance(response, dict)
assert response["uri"].startswith("jpip://")

params = getJPXInputParameters(
response = getJPX(
startTime=datetime(2014, 1, 1, 0, 0, 0),
endTime=datetime(2014, 1, 1, 0, 45, 0),
sourceId=14,
Expand All @@ -59,20 +55,17 @@ def test_json_response():
jpip=False,
cadence=None,
)
response = execute_api_call(params)
assert isinstance(response, dict)
assert response["uri"].startswith("https://")


def test_error_handling():
with pytest.raises(ValidationError, match="getJPXInputParameters\nstartTime\n field required"):
getJPXInputParameters(endTime=datetime(2014, 1, 1, 0, 45, 0), sourceId=14)

with pytest.raises(ValidationError, match="getJPXInputParameters\nendTime\n field required"):
getJPXInputParameters(startTime=datetime(2014, 1, 1, 0, 0, 0), sourceId=14)

with pytest.raises(ValidationError, match="getJPXInputParameters\nsourceId\n field required"):
getJPXInputParameters(startTime=datetime(2014, 1, 1, 0, 0, 0), endTime=datetime(2014, 1, 1, 0, 45, 0))
with pytest.raises(TypeError, match="missing 1 required positional argument: 'startTime'"):
getJPX(endTime=datetime(2014, 1, 1, 0, 45, 0), sourceId=14)
with pytest.raises(TypeError, match="missing 1 required positional argument: 'endTime'"):
getJPX(startTime=datetime(2014, 1, 1, 0, 0, 0), sourceId=14)
with pytest.raises(TypeError, match="missing 1 required positional argument: 'sourceId'"):
getJPX(startTime=datetime(2014, 1, 1, 0, 0, 0), endTime=datetime(2014, 1, 1, 0, 45, 0))


def test_url_property():
Expand Down
29 changes: 11 additions & 18 deletions hvpy/api_groups/jpeg2000/tests/test_get_jpx_closest_to_mid_point.py
Original file line number Diff line number Diff line change
@@ -1,57 +1,50 @@
from datetime import datetime

import pytest
from pydantic import ValidationError

from hvpy import getJPXClosestToMidPoint
from hvpy.api_groups.jpeg2000.get_jpx_closest_to_mid_point import getJPXClosestToMidPointInputParameters
from hvpy.core import execute_api_call

startTimes = [datetime(2014, 1, 1, 0, 0, 0), datetime(2014, 1, 1, 2, 3, 3), datetime(2014, 1, 1, 4, 5, 5)]
endTimes = [datetime(2014, 1, 1, 0, 45, 0), datetime(2014, 1, 1, 2, 33, 3), datetime(2014, 1, 1, 4, 54, 5)]


def test_raw_response():
params = getJPXClosestToMidPointInputParameters(
response = getJPXClosestToMidPoint(
startTimes=startTimes, endTimes=endTimes, sourceId=14, linked=False, verbose=False, jpip=False
)
response = execute_api_call(input_parameters=params)
assert isinstance(response, bytes)


def test_str_response():
params = getJPXClosestToMidPointInputParameters(
response = getJPXClosestToMidPoint(
startTimes=startTimes, endTimes=endTimes, sourceId=14, linked=False, verbose=False, jpip=True
)
response = execute_api_call(input_parameters=params)
assert isinstance(response, str)
assert response.startswith("jpip://")


def test_json_response():
params = getJPXClosestToMidPointInputParameters(
response = getJPXClosestToMidPoint(
startTimes=startTimes, endTimes=endTimes, sourceId=14, linked=False, verbose=True, jpip=True
)
response = execute_api_call(input_parameters=params)
assert isinstance(response, dict)
assert response["uri"].startswith("jpip://")

params = getJPXClosestToMidPointInputParameters(
response = getJPXClosestToMidPoint(
startTimes=startTimes, endTimes=endTimes, sourceId=14, linked=False, verbose=True, jpip=False
)
response = execute_api_call(input_parameters=params)
assert isinstance(response, dict)
assert response["uri"].startswith("https://")


def test_error_handling():
with pytest.raises(ValidationError, match="getJPXClosestToMidPointInputParameters\nstartTimes\n field required"):
getJPXClosestToMidPointInputParameters(endTimes=endTimes, sourceId=14)

with pytest.raises(ValidationError, match="getJPXClosestToMidPointInputParameters\nendTimes\n field required"):
getJPXClosestToMidPointInputParameters(startTimes=startTimes, sourceId=14)

with pytest.raises(ValidationError, match="getJPXClosestToMidPointInputParameters\nsourceId\n field required"):
getJPXClosestToMidPointInputParameters(startTimes=startTimes, endTimes=endTimes)
with pytest.raises(TypeError, match="missing 1 required positional argument: 'startTimes'"):
getJPXClosestToMidPoint(endTimes=endTimes, sourceId=14)
with pytest.raises(TypeError, match="missing 1 required positional argument: 'endTimes'"):
getJPXClosestToMidPoint(startTimes=startTimes, sourceId=14)
with pytest.raises(TypeError, match="missing 1 required positional argument: 'sourceId'"):
getJPXClosestToMidPoint(startTimes=startTimes, endTimes=endTimes)


def test_url_property():
Expand Down
5 changes: 2 additions & 3 deletions hvpy/api_groups/jpeg2000/tests/test_get_status.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from hvpy import getStatus
from hvpy.api_groups.jpeg2000.get_status import getStatusInputParameters
from hvpy.core import execute_api_call


def test_getStatusInputParameters():
params = getStatusInputParameters()
response = execute_api_call(input_parameters=params)
response = getStatus()
assert isinstance(response, dict)


Expand Down
Loading