File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
localstack-core/localstack Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 2020LOCALHOST_IP = "127.0.0.1"
2121LOCALHOST_HOSTNAME = "localhost.localstack.cloud"
2222
23+ # User-agent string used in outgoing HTTP requests made by LocalStack
24+ USER_AGENT_STRING = f"localstack/{ VERSION } "
25+
2326# version of the Maven dependency with Java utility code
2427LOCALSTACK_MAVEN_VERSION = "0.2.21"
2528MAVEN_REPO_URL = "https://repo1.maven.org/maven2"
Original file line number Diff line number Diff line change 44
55import requests
66
7+ from localstack .constants import USER_AGENT_STRING
78from localstack .packages import InstallTarget , Package
89from localstack .packages .core import ArchiveDownloadAndExtractInstaller
910from localstack .utils .files import rm_rf
@@ -100,7 +101,8 @@ def _download_url_latest_release(self) -> str:
100101 f"https://api.adoptium.net/v3/assets/latest/{ self .version } /hotspot?"
101102 f"os=linux&architecture={ self .arch } &image_type=jdk"
102103 )
103- response = requests .get (endpoint , headers = {"user-agent" : "example/0.0.0" }).json ()
104+ # Override user-agent because Adoptium API denies service to `requests` library
105+ response = requests .get (endpoint , headers = {"user-agent" : USER_AGENT_STRING }).json ()
104106 return response [0 ]["binary" ]["package" ]["link" ]
105107
106108 def _download_url_fallback (self ) -> str :
You can’t perform that action at this time.
0 commit comments