hdpws 0.6.18__py3-none-any.whl → 0.6.22__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hdpws/__init__.py CHANGED
@@ -24,7 +24,7 @@
24
24
  #
25
25
  # NOSA HEADER END
26
26
  #
27
- # Copyright (c) 2023 United States Government as represented by
27
+ # Copyright (c) 2023-2024 United States Government as represented by
28
28
  # the National Aeronautics and Space Administration. No copyright is
29
29
  # claimed in the United States under Title 17, U.S.Code. All Other
30
30
  # Rights Reserved.
@@ -34,14 +34,14 @@
34
34
  Package for accessing the NASA's Heliophysics Data Portal (HDP) web
35
35
  services https://heliophysicsdata.gsfc.nasa.gov/WebServices/.
36
36
 
37
- Copyright © 2023 United States Government as represented by the
37
+ Copyright © 2023-2024 United States Government as represented by the
38
38
  National Aeronautics and Space Administration. No copyright is claimed in
39
39
  the United States under Title 17, U.S.Code. All Other Rights Reserved.
40
40
 
41
41
  """
42
42
 
43
43
 
44
- __version__ = "0.6.18"
44
+ __version__ = "0.6.22"
45
45
 
46
46
 
47
47
  #
hdpws/__main__.py CHANGED
@@ -147,6 +147,14 @@ def example(
147
147
  disable_ssl_certificate_validation, user_agent='Example')
148
148
 
149
149
 
150
+ result = hdp.get_application_interfaces()
151
+ if result['HttpStatus'] == 200:
152
+ print('HDP ApplicationInterfaces:')
153
+ for value in result['ApplicationInterface']:
154
+ print(f' {value}')
155
+ else:
156
+ print_error('hdp.get_application_interfaces', result)
157
+
150
158
  result = hdp.get_keywords()
151
159
  if result['HttpStatus'] == 200:
152
160
  print('HDP Keywords:')
@@ -395,6 +403,27 @@ def example(
395
403
  print_error('hdp.get_spase_document', result)
396
404
 
397
405
 
406
+ query = {
407
+ 'ResourceID': 'spase://CCMC/Software/Kamodo',
408
+ 'CodeLanguage': 'Python',
409
+ 'Description': '"space weather models and data"'
410
+ }
411
+
412
+
413
+ if result['HttpStatus'] == 200:
414
+ #print('HDP Spase:')
415
+ #print(ET.tostring(result['Result']))
416
+ print('Result Software:')
417
+ for software in result['Result'].findall('.//Software', namespaces=NS):
418
+ print(software.findall('.//ResourceID', namespaces=NS)[0].text)
419
+ print(' ', software.findall('.//ResourceName', namespaces=NS)[0].text)
420
+ #ET.indent(software)
421
+ #print(ET.tostring(software, encoding='unicode',
422
+ # default_namespace=SPASE_NS))
423
+ else:
424
+ print_error('hdp.get_spase_software', result)
425
+
426
+
398
427
  def print_error(
399
428
  label: str,
400
429
  result: Dict
hdpws/hdpws.py CHANGED
@@ -24,7 +24,7 @@
24
24
  #
25
25
  # NOSA HEADER END
26
26
  #
27
- # Copyright (c) 2023 United States Government as represented by
27
+ # Copyright (c) 2023-2024 United States Government as represented by
28
28
  # the National Aeronautics and Space Administration. No copyright is
29
29
  # claimed in the United States under Title 17, U.S.Code. All Other
30
30
  # Rights Reserved.
@@ -197,6 +197,33 @@ class HdpWs:
197
197
  return self._endpoint
198
198
 
199
199
 
200
+ def get_application_interfaces(
201
+ self
202
+ ) -> Dict:
203
+ """
204
+ Gets all /Spase/Software/ApplicationInterface values available at HDP.
205
+
206
+ Returns
207
+ -------
208
+ Dict
209
+ Dictionary containing a 'ApplicationInterface' key with a value
210
+ of a List containing all /Spase/Software/ApplicationInterface values
211
+ with the addition of the following key/values:<br>
212
+ - HttpStatus: with the value of the HTTP status code.
213
+ Successful == 200.<br>
214
+ When HttpStatus != 200:<br>
215
+ - HttpText: containing a string representation of the HTTP
216
+ entity body.<br>
217
+ When HttpText is a standard HDP WS error entity body the
218
+ following key/values (convenience to avoid parsing
219
+ HttpStatus):<br>
220
+ - ErrorMessage: value from HttpText.<br>
221
+ - ErrorDescription: value from HttpText.<br>
222
+ """
223
+ return self.__get_simple_resource('Spase/ApplicationInterface',
224
+ 'ApplicationInterface',
225
+ 'ApplicationInterface')
226
+
200
227
  def get_keywords(
201
228
  self
202
229
  ) -> Dict:
@@ -818,6 +845,83 @@ class HdpWs:
818
845
  return self.__get_complex_resource([ResourceType.DOCUMENT], query)
819
846
 
820
847
 
848
+ def get_spase_service(
849
+ self,
850
+ query: Dict
851
+ ) -> Dict:
852
+ """
853
+ Gets the specified SPASE Service documents from HDP.
854
+
855
+ Parameters
856
+ ----------
857
+ query
858
+ Dictionary containing query parameters and values. For
859
+ example,<pre>
860
+ query = {
861
+ 'ResourceID': 'spase://CCMC/Service/InstantRun',
862
+ 'Description': '"Instan-Run"'
863
+ }</pre>
864
+
865
+ Returns
866
+ -------
867
+ Dict
868
+ Dictionary containing a 'Result' key with a value of an
869
+ ElementTree representation of the results as described by
870
+ <https://heliophysicsdata.gsfc.nasa.gov/WebServices/hdpspase.xsd>
871
+ with the addition of the following key/values:<br>
872
+ - HttpStatus: with the value of the HTTP status code.
873
+ Successful == 200.<br>
874
+ When HttpStatus != 200:<br>
875
+ - HttpText: containing a string representation of the HTTP
876
+ entity body.<br>
877
+ When HttpText is a standard HDP WS error entity body the
878
+ following key/values (convenience to avoid parsing
879
+ HttpStatus):<br>
880
+ - ErrorMessage: value from HttpText.<br>
881
+ - ErrorDescription: value from HttpText.<br>
882
+ """
883
+ return self.__get_complex_resource([ResourceType.SERVICE], query)
884
+
885
+
886
+ def get_spase_software(
887
+ self,
888
+ query: Dict
889
+ ) -> Dict:
890
+ """
891
+ Gets the specified SPASE Software documents from HDP.
892
+
893
+ Parameters
894
+ ----------
895
+ query
896
+ Dictionary containing query parameters and values. For
897
+ example,<pre>
898
+ query = {
899
+ 'ResourceID': 'spase://CCMC/Software/Kamodo',
900
+ 'CodeLanguage': 'Python',
901
+ 'Description': '"space weather models and data"'
902
+ }</pre>
903
+
904
+ Returns
905
+ -------
906
+ Dict
907
+ Dictionary containing a 'Result' key with a value of an
908
+ ElementTree representation of the results as described by
909
+ <https://heliophysicsdata.gsfc.nasa.gov/WebServices/hdpspase.xsd>
910
+ with the addition of the following key/values:<br>
911
+ - HttpStatus: with the value of the HTTP status code.
912
+ Successful == 200.<br>
913
+ When HttpStatus != 200:<br>
914
+ - HttpText: containing a string representation of the HTTP
915
+ entity body.<br>
916
+ When HttpText is a standard HDP WS error entity body the
917
+ following key/values (convenience to avoid parsing
918
+ HttpStatus):<br>
919
+ - ErrorMessage: value from HttpText.<br>
920
+ - ErrorDescription: value from HttpText.<br>
921
+ """
922
+ return self.__get_complex_resource([ResourceType.SOFTWARE], query)
923
+
924
+
821
925
  def __get_simple_resource(
822
926
  self,
823
927
  resource: str,
hdpws/resourcetype.py CHANGED
@@ -52,3 +52,4 @@ class ResourceType(Enum):
52
52
  DISPLAY_DATA = 'DisplayData'
53
53
  OBSERVATORY = 'Observatory'
54
54
  SERVICE = 'Service'
55
+ SOFTWARE = 'Software'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hdpws
3
- Version: 0.6.18
3
+ Version: 0.6.22
4
4
  Summary: NASA's Heliophysics Data Portal Web Service Client Library
5
5
  Home-page: https://heliophysicsdata.gsfc.nasa.gov/WebServices
6
6
  Author: Bernie Harris
@@ -47,13 +47,11 @@ To run the included example, do the following
47
47
 
48
48
  ---
49
49
 
50
- The following [Jupyter notebooks](https://jupyter.org/) demonstrate
50
+ Also, the following [Jupyter notebooks](https://jupyter.org/) demonstrate
51
51
  different features of the library:
52
- 1. [Simple Query Example](https://heliophysicsdata.gsfc.nasa.gov/WebServices/jupyter/HdpWsExample.html) ([ipynb file](https://heliophysicsdata.gsfc.nasa.gov/WebServices/jupyter/HdpWsExample.ipynb))demonstrating a simple query.
53
- 2. [Example with data retrieval](https://heliophysicsdata.gsfc.nasa.gov/WebServices/jupyter/HdpWsExampleWithCdasWs.html) using [cdasws](https://pypi.org/project/cdasws/) ([ipynb file](https://heliophysicsdata.gsfc.nasa.gov/WebServices/jupyter/HdpWsExampleWithCdasWs.ipynb)).
52
+ 1. [Simple Query Example](https://heliophysicsdata.gsfc.nasa.gov/WebServices/jupyter/HdpWsExample.html) ([ipynb file](https://heliophysicsdata.gsfc.nasa.gov/WebServices/jupyter/HdpWsExample.ipynb)) demonstrating a simple query. [Launch on Binder](https://mybinder.org/v2/gh/berniegsfc/hdpws-notebooks/main?labpath=HdpWsExample.ipynb).
53
+ 2. [Example with data retrieval](https://heliophysicsdata.gsfc.nasa.gov/WebServices/jupyter/HdpWsExampleWithCdasWs.html) using [cdasws](https://pypi.org/project/cdasws/) ([ipynb file](https://heliophysicsdata.gsfc.nasa.gov/WebServices/jupyter/HdpWsExampleWithCdasWs.ipynb)). [Launch on Binder](https://mybinder.org/v2/gh/berniegsfc/hdpws-notebooks/main?labpath=HdpWsExampleWithCdasWs.ipynb).
54
54
 
55
- These notebooks will eventually be available on
56
- [Binder](https://mybinder.org/v2/gh/berniegsfc/hdpws-notebooks/main).
57
55
 
58
56
  ## Motivation
59
57
 
@@ -0,0 +1,11 @@
1
+ hdpws/__init__.py,sha256=N9oVbW1qhgeECE9f7QWqy2vV-1G0a8lgppXiwht-0C8,2059
2
+ hdpws/__main__.py,sha256=vumYLbz12sIRum3o6BNDw0XOzGrYMOvNCM2cufHBpb4,15241
3
+ hdpws/dateinterval.py,sha256=OwFRQUbTMyzR1R7T5gSKT2st4PbLWAwOtcsP7_PqQys,4901
4
+ hdpws/hdpws.py,sha256=EYnnCo2JtkP5GjpykxF6VGz1NmGFTVTuh3g4yjCAmqQ,40168
5
+ hdpws/resourcetype.py,sha256=ybBKFKDcVesRkRKb-mEXIxRt-INed3QZzysx1rmy6bo,1771
6
+ hdpws/spase.py,sha256=ylnH9mh1McwwyB6-LzaOOWr1ggJiuNgcEH3-6mXJjfI,13343
7
+ hdpws-0.6.22.dist-info/LICENSE,sha256=9VDxMcDDn3_T-sDQTMPxmiPZBDkPIiTO4OzYK5olDmk,12589
8
+ hdpws-0.6.22.dist-info/METADATA,sha256=GGmJKY62xmIhNrllEjFQTWlJxS9G0Jp6al2jmH_i-lM,3656
9
+ hdpws-0.6.22.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
10
+ hdpws-0.6.22.dist-info/top_level.txt,sha256=BTo-2sxU1YuKAD5Ykfc8bNQvgVX486A74voiQxV4NiQ,6
11
+ hdpws-0.6.22.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- hdpws/__init__.py,sha256=g8DxcAZIN8aJO6XHL0Pu2b1B3NOy14p5DVRjVVtpBuM,2049
2
- hdpws/__main__.py,sha256=PgHfzwwUy56Rk-kHm7SDkoUGC4oN7z0DUJ1KhsVvI4g,14181
3
- hdpws/dateinterval.py,sha256=OwFRQUbTMyzR1R7T5gSKT2st4PbLWAwOtcsP7_PqQys,4901
4
- hdpws/hdpws.py,sha256=an9VJdBBzI73DC1QmRcOVmXdx6rN1ZUZiqAgCtLHFTg,36157
5
- hdpws/resourcetype.py,sha256=V3ge09mdFfN7tOl6txk9nF_dPr04L7ReoV7WoL0IneE,1745
6
- hdpws/spase.py,sha256=ylnH9mh1McwwyB6-LzaOOWr1ggJiuNgcEH3-6mXJjfI,13343
7
- hdpws-0.6.18.dist-info/LICENSE,sha256=9VDxMcDDn3_T-sDQTMPxmiPZBDkPIiTO4OzYK5olDmk,12589
8
- hdpws-0.6.18.dist-info/METADATA,sha256=fcQRmzMB1_ElroYo_omfKEj73bynblnCji3PdxK_sTI,3543
9
- hdpws-0.6.18.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
10
- hdpws-0.6.18.dist-info/top_level.txt,sha256=BTo-2sxU1YuKAD5Ykfc8bNQvgVX486A74voiQxV4NiQ,6
11
- hdpws-0.6.18.dist-info/RECORD,,
File without changes