forked from platformio/platformio-core
Escape custom request arguments
This commit is contained in:
@ -151,7 +151,7 @@ class HTTPClient(object):
|
|||||||
def fetch_json_data(self, method, path, **kwargs):
|
def fetch_json_data(self, method, path, **kwargs):
|
||||||
if method != "get":
|
if method != "get":
|
||||||
cleanup_content_cache("http")
|
cleanup_content_cache("http")
|
||||||
cache_valid = kwargs.pop("cache_valid") if "cache_valid" in kwargs else None
|
cache_valid = kwargs.pop("x_cache_valid") if "x_cache_valid" in kwargs else None
|
||||||
if not cache_valid:
|
if not cache_valid:
|
||||||
return self._parse_json_response(self.send_request(method, path, **kwargs))
|
return self._parse_json_response(self.send_request(method, path, **kwargs))
|
||||||
cache_key = ContentCache.key_from_args(
|
cache_key = ContentCache.key_from_args(
|
||||||
|
@ -135,7 +135,7 @@ class RegistryClient(HTTPClient):
|
|||||||
"get",
|
"get",
|
||||||
"/v3/search",
|
"/v3/search",
|
||||||
params=params,
|
params=params,
|
||||||
cache_valid="1h",
|
x_cache_valid="1h",
|
||||||
x_with_authorization=self.allowed_private_packages(),
|
x_with_authorization=self.allowed_private_packages(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ class RegistryClient(HTTPClient):
|
|||||||
type=type_, owner=owner.lower(), name=name.lower()
|
type=type_, owner=owner.lower(), name=name.lower()
|
||||||
),
|
),
|
||||||
params=dict(version=version) if version else None,
|
params=dict(version=version) if version else None,
|
||||||
cache_valid="1h",
|
x_cache_valid="1h",
|
||||||
x_with_authorization=self.allowed_private_packages(),
|
x_with_authorization=self.allowed_private_packages(),
|
||||||
)
|
)
|
||||||
except HTTPClientError as e:
|
except HTTPClientError as e:
|
||||||
|
@ -61,7 +61,7 @@ def platform_frameworks(query, json_output):
|
|||||||
regclient = PlatformPackageManager().get_registry_client_instance()
|
regclient = PlatformPackageManager().get_registry_client_instance()
|
||||||
frameworks = []
|
frameworks = []
|
||||||
for framework in regclient.fetch_json_data(
|
for framework in regclient.fetch_json_data(
|
||||||
"get", "/v2/frameworks", cache_valid="1d"
|
"get", "/v2/frameworks", x_cache_valid="1d"
|
||||||
):
|
):
|
||||||
if query == "all":
|
if query == "all":
|
||||||
query = ""
|
query = ""
|
||||||
@ -354,7 +354,7 @@ def _print_platforms(platforms):
|
|||||||
|
|
||||||
def _get_registry_platforms():
|
def _get_registry_platforms():
|
||||||
regclient = PlatformPackageManager().get_registry_client_instance()
|
regclient = PlatformPackageManager().get_registry_client_instance()
|
||||||
return regclient.fetch_json_data("get", "/v2/platforms", cache_valid="1d")
|
return regclient.fetch_json_data("get", "/v2/platforms", x_cache_valid="1d")
|
||||||
|
|
||||||
|
|
||||||
def _get_platform_data(*args, **kwargs):
|
def _get_platform_data(*args, **kwargs):
|
||||||
|
Reference in New Issue
Block a user