diff --git a/md/demo1.py b/md/demo1.py deleted file mode 100644 index 9cbfcfb..0000000 --- a/md/demo1.py +++ /dev/null @@ -1,39 +0,0 @@ -import base64 -from sys import prefix -import requests - -from urllib.parse import urlparse,unquote, urlunparse - -# # 原始 URL -# url = "http%3A%2F%2F112.95.163.96%3A13095%2Fapi%2Fv1.0%2Fpredictions%3Fserving%3D27e77247-a61d-4c63-8d04-d944912f6ca3&jobName=resnet50v4-5108&mic=FO19ZRWkLDADYKq2%2BzkJxqVj4BM63M99HmcOStCtB34%3D&backend=inference&usertoken=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI3OGVkMWVhMmVhZjE0MWNmOWYyNWNiZjQ2MDdlNDQ2MyIsImF1ZCI6Ijc4ZWQxZWEyZWFmMTQxY2Y5ZjI1Y2JmNDYwN2U0NDYzIiwic2lnbkFwcCI6ImZyb250IiwiaXNzIjoid3d3LmJpdGFodWIuY29tIiwiZXhwIjoxNzIxOTA5MjMwLCJpYXQiOjE3MjE4NzMyMzAsImp0aSI6IjE3MjE5NzMyMzk4MTcifQ.-0Wt05pybFP-RDGwDInKowQbopJXZp6SyWJYF7A8dD" -# # URL 解码 -# decoded_url = urlparse(unquote(url)) -# print(decoded_url) -# url = url.replace("%3A", ":").replace("%2F", "/").replace("%3F", "?").replace("%3D", "=").replace("%26", "&") -# print(url) -# endpoint = "112.95.163.96:13095" -# ori_prefix = f'{decoded_url.scheme}://{decoded_url.netloc}' -# prefix = f'{decoded_url.scheme}://{endpoint}' -# print(f"解码后的 URL: {prefix+url[len(ori_prefix):-1]}") -# dest = prefix+url[len(ori_prefix):-1] - -# URL 再编码,保留安全字符 -# re_encoded_url = urlencode(decoded_url) -# print(f"再编码后的 URL: {re_encoded_url}") - -# # 解码 URL -# parsed_url = urlparse(unquote(url)) - -# print(parsed_url) -# print(f'原始 URL: {url}\n') -# print(f'解码后的路径: {parsed_url.path}\n') -# print(f'quote URL: {quote(new_url)}\n') - -import requests -files = { - "images": ('./cat.jpg', open('./cat.jpg', "rb"), "image/jpeg") -} -response = requests.post("http://localhost:8080/", files=files, verify=False) - -print(response.status_code) -print(response.text)