国外区域、天气api获取
This commit is contained in:
@ -32,8 +32,8 @@ public class AbroadAddressUtils {
|
|||||||
try {
|
try {
|
||||||
url = new URL(urlString);
|
url = new URL(urlString);
|
||||||
// 创建代理(如果不需要代理,可以移除这部分)
|
// 创建代理(如果不需要代理,可以移除这部分)
|
||||||
Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", 4781));
|
// Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", 4781));
|
||||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection(proxy);
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
conn.setRequestMethod("GET");
|
conn.setRequestMethod("GET");
|
||||||
conn.setConnectTimeout(10000); // 10秒连接超时
|
conn.setConnectTimeout(10000); // 10秒连接超时
|
||||||
conn.setReadTimeout(10000); // 10秒读取超时
|
conn.setReadTimeout(10000); // 10秒读取超时
|
||||||
|
|||||||
Reference in New Issue
Block a user