Skip to content

Commit 4225e4b

Browse files
committed
Merge branch 'release_24.2' into release_25.0
2 parents a8c7df7 + 4ea216f commit 4225e4b

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

lib/galaxy_test/selenium/test_data_source_tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import pytest
12
from selenium.webdriver.support.ui import Select
23

34
from galaxy.util.unittest_utils import skip_if_site_down
@@ -12,6 +13,7 @@
1213
class TestDataSource(SeleniumTestCase, UsesHistoryItemAssertions):
1314
ensure_registered = True
1415

16+
@pytest.mark.skip("Skipping UCSC table direct1 data source test, chromedriver fails captcha")
1517
@selenium_test
1618
@managed_history
1719
@skip_if_site_down("https://genome.ucsc.edu/cgi-bin/hgTables")

tools/data_source/data_source.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
urlencode,
99
urlparse,
1010
)
11-
from urllib.request import urlopen
11+
from urllib.request import (
12+
Request,
13+
urlopen,
14+
)
1215

1316
from galaxy.datatypes import sniff
1417
from galaxy.datatypes.registry import Registry
@@ -17,6 +20,7 @@
1720
get_charset_from_http_headers,
1821
stream_to_open_named_file,
1922
)
23+
from galaxy.util.user_agent import get_default_headers
2024

2125
GALAXY_PARAM_PREFIX = "GALAXY"
2226
GALAXY_ROOT_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
@@ -51,15 +55,16 @@ def __main__():
5155
sys.exit("The remote data source application has not sent back a URL parameter in the request.")
5256

5357
# The following calls to urlopen() will use the above default timeout
58+
headers = get_default_headers()
5459
try:
5560
if URL_method == "get":
56-
page = urlopen(cur_URL, timeout=DEFAULT_SOCKET_TIMEOUT)
61+
req = Request(cur_URL, headers=headers)
5762
elif URL_method == "post":
58-
page = urlopen(
59-
cur_URL,
60-
urlencode(params["param_dict"]["incoming_request_params"]).encode("utf-8"),
61-
timeout=DEFAULT_SOCKET_TIMEOUT,
62-
)
63+
data = urlencode(params["param_dict"]["incoming_request_params"]).encode("utf-8")
64+
req = Request(cur_URL, data=data, headers=headers)
65+
else:
66+
raise Exception("Unknown URL_method specified: %s" % URL_method)
67+
page = urlopen(req, timeout=DEFAULT_SOCKET_TIMEOUT)
6368
except Exception as e:
6469
sys.exit("The remote data source application may be off line, please try again later. Error: %s" % str(e))
6570
if max_file_size:

0 commit comments

Comments
 (0)