-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test in the cefi_portal directly
pytest rely on regional mom6 is removed to keep the indepency of the portal test
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
This script is designed to test the opendap | ||
access | ||
""" | ||
import os | ||
import sys | ||
import requests | ||
|
||
|
||
CATALOG_HEAD = 'https://psl.noaa.gov/thredds/catalog/' | ||
REGIONAL_MOM6_PATH = 'Projects/CEFI/regional_mom6' | ||
|
||
catalog_url = os.path.join( | ||
CATALOG_HEAD, | ||
REGIONAL_MOM6_PATH, | ||
'catalog.html' | ||
) | ||
|
||
try: | ||
html_response = requests.get(catalog_url, timeout=10) | ||
|
||
if html_response.status_code == 200: | ||
print("Success: URL responded with status 200.") | ||
sys.exit(0) # Exit with status 0 (success) | ||
else: | ||
print(f"Error: URL responded with status {html_response.status_code}.") | ||
sys.exit(1) # Exit with status 1 (non-success) | ||
except requests.exceptions.RequestException as e: | ||
print(f"Error: Failed to connect to {catalog_url}. Exception: {e}") | ||
sys.exit(2) # Exit with status 2 (connection failure) |