什么等效于Python中Java的apache httpclient

时间:2018-07-02 11:36:20

标签: python python-2.7 python-requests

相当于Python中Java的apache httpclient。下面是我们如何使用httpclient在Java中进行操作

CloseableHttpClient httpClient = HttpClients.createDefault();
        HttpGet httpGet = new HttpGet(GET_URL);
        httpGet.addHeader("User-Agent", USER_AGENT);
        CloseableHttpResponse httpResponse = httpClient.execute(httpGet)

;

1 个答案:

答案 0 :(得分:0)

在“纯” python 2.7(我的意思是仅使用stdlib)中,它将是urllib2,但事实上的标准现在是第三方python-requests软件包。