# Autt **Repository Path**: iozxc/autt ## Basic Information - **Project Name**: Autt - **Description**: 简单的http请求工具、可存储cookie的http工具包,用于有cookie关联的请求模拟 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: http://omisheep.cn - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-09-10 - **Last Updated**: 2023-02-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: Java, Http, HttpClient, java-util ## README # **Autt** 简单的http请求工具、可存储cookie的http工具包 ### 介绍: > 1. 可存储cookie > 2. 自动匹配返回内容的字符集 > 3. 可接收任意类型返回数据(json、图片、视频等) #### 一、Maven依赖 ```xml cn.omisheep autt 1.1.7 ``` #### 二、 Demo ```java class Main { public static void main(String[] args) { Autt.post("url_1").then() .get("url_2").then(response -> { System.out.println(response.getBodyJSONObject()); }); // 这些请求会使用同一Cookie Autt.get("url_登录api").then() .get("url_爬取数据").then(response -> { Document bodyDocument = response.getBodyDocument(); Element xxx = bodyDocument.getElementById("xxx"); // ... }) .post("其他操作").then() .post("").then(); // 这些请求会使用同一Cookie Response response = Autt.post("url", "{\"name\":\"zxc\"}", ContentType.JSON).send(); System.out.println(response.getBodyPrettyJSON()); Connect connect = Autt.connect(); // connect.get().then().get().then().get().then() ... 同一Connect的请求会使用同一Cookie } } ```