Repository: ioos/erddapy

Issue:
HTTP Error with erddap V2.10
seems a little something has changed and is throwing an error - I've not looked into the erddapy code but here is what I did (both on the swfsc erddap server and my own):

```
from erddapy import ERDDAP
import pandas as pd

e = ERDDAP(server="https://coastwatch.pfeg.noaa.gov/erddap")

print(url)

url = e.get_search_url(search_for="whoi", response="csv")

df = pd.read_csv(url)
print(
    f'We have {len(set(df["tabledap"].dropna()))} '
    f'tabledap, {len(set(df["griddap"].dropna()))} '
    f'griddap, and {len(set(df["wms"].dropna()))} wms endpoints.'
)
```

Throws a http 500 error and following  the generated link gives the following explicit error:

```
Error {
    code=500;
    message="Internal Server Error: ERROR in parseISODateTime: for first character of dateTime='(ANY)' isn't a digit!";
}
```

Discussion:

Patch:
diff --git a/erddapy/erddapy.py b/erddapy/erddapy.py
index a70a7b9..da76b21 100644
--- a/erddapy/erddapy.py
+++ b/erddapy/erddapy.py
@@ -258,7 +258,9 @@ class ERDDAP:
             maxTime=kwargs.get("max_time", default),
             searchFor=search_for,
         )
-
+        # ERDDAP 2.10 no longer accepts strings placeholder for dates.
+        # Removing them entirely should be OK for older versions too.
+        url = url.replace("&minTime=(ANY)", "").replace("&maxTime=(ANY)", "")
         return url
 
     def get_info_url(


Test patch:
diff --git a/tests/cassettes/test_erddap2_10.yaml b/tests/cassettes/test_erddap2_10.yaml
new file mode 100644
index 0000000..36f6081
--- /dev/null
+++ b/tests/cassettes/test_erddap2_10.yaml
@@ -0,0 +1,38 @@
+interactions:
+- request:
+    body: null
+    headers:
+      Accept:
+      - '*/*'
+      Accept-Encoding:
+      - gzip, deflate
+      Connection:
+      - keep-alive
+      User-Agent:
+      - python-requests/2.24.0
+    method: HEAD
+    uri: https://coastwatch.pfeg.noaa.gov/erddap/search/advanced.csv?page=1&itemsPerPage=1000&protocol=(ANY)&cdm_data_type=(ANY)&institution=(ANY)&ioos_category=(ANY)&keywords=(ANY)&long_name=(ANY)&standard_name=(ANY)&variableName=(ANY)&minLon=(ANY)&maxLon=(ANY)&minLat=(ANY)&maxLat=(ANY)&searchFor=whoi
+  response:
+    body:
+      string: ''
+    headers:
+      Connection:
+      - close
+      Content-Disposition:
+      - attachment;filename=AdvancedSearch.csv
+      Content-Encoding:
+      - gzip
+      Content-Length:
+      - '5231'
+      Content-Type:
+      - text/csv;charset=ISO-8859-1
+      Date:
+      - Wed, 11 Nov 2020 13:50:28 GMT
+      Strict-Transport-Security:
+      - max-age=31536000; includeSubDomains
+      X-Frame-Options:
+      - SAMEORIGIN
+    status:
+      code: 200
+      message: ''
+version: 1
diff --git a/tests/test_erddapy.py b/tests/test_erddapy.py
index 1fa561e..5ec9f1b 100644
--- a/tests/test_erddapy.py
+++ b/tests/test_erddapy.py
@@ -3,6 +3,7 @@ from datetime import datetime
 import pendulum
 import pytest
 import pytz
+import requests
 
 from requests.exceptions import ReadTimeout
 
@@ -96,3 +97,12 @@ def test_erddap_requests_kwargs():
 
     with pytest.raises(ReadTimeout):
         connection.to_xarray()
+
+
+@pytest.mark.web
+@pytest.mark.vcr()
+def test_erddap2_10():
+    e = ERDDAP(server="https://coastwatch.pfeg.noaa.gov/erddap")
+    url = e.get_search_url(search_for="whoi", response="csv")
+    r = requests.head(url)
+    assert r.raise_for_status() is None