質問編集履歴

2

プロキシ設定なしでの実行

2024/07/12 04:29

投稿

gymgym
gymgym

スコア99

test CHANGED
File without changes
test CHANGED
@@ -3,6 +3,9 @@
3
3
 
4
4
  ### 発生している問題・分からないこと
5
5
  FastAPIでサーバーは構築できるが、requestsでアクセスしようとしたら、ステータスが503になる
6
+
7
+ curl "http://localhost:8080"ではうまく実行されます。
8
+ pythonでrequestsから実行すると530になってしまいます。
6
9
 
7
10
  ### エラーメッセージ
8
11
  ```error
@@ -12,7 +15,7 @@
12
15
  <meta type="copyright" content="Copyright (C) 1996-2016 The Squid Software Foundation and contributors">
13
16
  <meta http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">
14
17
  <title>ERROR: The requested URL could not be retrieved</title>
15
- <style type="text/css"><!--
18
+ <style type="text/css"><!--
16
19
  /*
17
20
  * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
18
21
  *
@@ -142,17 +145,15 @@
142
145
 
143
146
  <p>The remote host or network may be down. Please try the request again.</p>
144
147
 
145
-
146
148
  <br>
147
149
  </div>
148
150
 
149
151
  <hr>
150
152
  <div id="footer">
151
- <p>Generated Fri, 12 Jul 2024 03:20:42 GMT by unknown (squid/3.5.20)</p>
153
+ <p>Generated Fri, 12 Jul 2024 04:24:54 GMT by unknown (squid/3.5.20)</p>
152
154
  <!-- ERR_CONNECT_FAIL -->
153
155
  </div>
154
156
  </body></html>
155
- ```
156
157
 
157
158
  ### 該当のソースコード
158
159
 
@@ -181,7 +182,8 @@
181
182
  'http': 'http://proxy',
182
183
  'https': 'http://proxy',
183
184
  }
184
- res = requests.get("http://localhost:8080", proxies=proxies)
185
+ #res = requests.get("http://localhost:8080", proxies=proxies)
186
+ res = requests.get("http://localhost:8080")
185
187
 
186
188
  print(res.status_code)
187
189
  print(res.text)

1

エラーの内容を編集しました

2024/07/12 03:35

投稿

gymgym
gymgym

スコア99

test CHANGED
File without changes
test CHANGED
@@ -142,7 +142,6 @@
142
142
 
143
143
  <p>The remote host or network may be down. Please try the request again.</p>
144
144
 
145
- <p>Your cache administrator is <a href="mailto:IT-infra@ykk.co.jp?subject=CacheErrorInfo%20-%20ERR_CONNECT_FAIL&amp;body=CacheHost%3A%20unknown%0D%0AErrPage%3A%20ERR_CONNECT_FAIL%0D%0AErr%3A%20(111)%20Connection%20refused%0D%0ATimeStamp%3A%20Fri,%2012%20Jul%202024%2003%3A20%3A42%20GMT%0D%0A%0D%0AClientIP%3A%20172.28.204.102%0D%0AServerIP%3A%20localhost%0D%0A%0D%0AHTTP%20Request%3A%0D%0AGET%20%2F%20HTTP%2F1.1%0AUser-Agent%3A%20python-requests%2F2.31.0%0D%0AAccept-Encoding%3A%20gzip,%20deflate%0D%0AAccept%3A%20*%2F*%0D%0AConnection%3A%20keep-alive%0D%0AHost%3A%20localhost%3A8080%0D%0A%0D%0A%0D%0A">IT-infra@ykk.co.jp</a>.</p>
146
145
 
147
146
  <br>
148
147
  </div>