Revert some requests import changes

introduced in https://github.com/galaxyproject/galaxy/pull/18003 .
In particular, when using requests in the tests to connect to Galaxy
or the ToolShed it's not needed to use the modified headers.

Also:
- Move some imports after conditional imports.
- Fix type annotations in `lib/tool_shed/test/base/populators.py`
- Fix typo bug in `test/unit/util/test_get_url.py`
This commit is contained in:
Nicola Soranzo
2024-05-22 09:16:28 +01:00
parent 2aec162d4e
commit 8cdca0f343
22 changed files with 30 additions and 43 deletions
+1 -2
View File
@@ -1,10 +1,9 @@
import argparse
import json
import requests
import yaml
from galaxy.util import requests
def main():
parser = argparse.ArgumentParser(description="Upload a directory into a data library")
+1 -1
View File
@@ -5,7 +5,7 @@ Sample script for Galaxy Search API
import json
import sys
from galaxy.util import requests
import requests
class RemoteGalaxy:
+1 -8
View File
@@ -7,14 +7,7 @@ import json
import os
import sys
try:
from galaxy.util import requests
except ImportError:
print(
"Could not import the requests module. See http://docs.python-requests.org/en/latest/"
" or install with 'pip install requests'"
)
raise
import requests
def upload_file(base_url, api_key, history_id, filepath, **kwargs):
+1 -2
View File
@@ -2,11 +2,10 @@
import os
import click
import requests
from tusclient import client
from tusclient.storage import filestorage
from galaxy.util import requests
UPLOAD_ENDPOINT = "/api/upload/resumable_upload"
SUBMISSION_ENDPOINT = "/api/tools/fetch"
CHUNK_SIZE = 10**7
+1 -1
View File
@@ -1,4 +1,4 @@
from galaxy.util import requests
import requests
def delete(api_key, url, data, return_formatted=True):