Code Duplication    Length = 19-19 lines in 2 locations

tabpy/tabpy_tools/rest.py 2 locations

@@ 114-132 (lines=19) @@
111
112
        return response.json()
113
114
    def PUT(self, url, data, timeout=None):
115
        """Issues a PUT request to the URL with the data specified. Returns an
116
        object that is parsed from the response JSON."""
117
        data = self._encode_request(data)
118
119
        logger.info(f"PUT {url} with {data}")
120
121
        response = self.session.put(
122
            url,
123
            data=data,
124
            headers={"content-type": "application/json"},
125
            timeout=timeout,
126
            auth=self.auth,
127
        )
128
        if response.status_code != 200:
129
            self.raise_error(response)
130
131
        return response.json()
132
133
    def DELETE(self, url, data, timeout=None):
134
        """
135
        Issues a DELETE request to the URL with the data specified. Returns an
@@ 95-113 (lines=19) @@
92
        else:
93
            return response.json()
94
95
    def POST(self, url, data, timeout=None):
96
        """Issues a POST request to the URL with the data specified. Returns an
97
        object that is parsed from the response JSON."""
98
        data = self._encode_request(data)
99
100
        logger.info(f"POST {url} with {data}")
101
        response = self.session.post(
102
            url,
103
            data=data,
104
            headers={"content-type": "application/json"},
105
            timeout=timeout,
106
            auth=self.auth,
107
        )
108
109
        if response.status_code not in (200, 201):
110
            self.raise_error(response)
111
112
        return response.json()
113
114
    def PUT(self, url, data, timeout=None):
115
        """Issues a PUT request to the URL with the data specified. Returns an
116
        object that is parsed from the response JSON."""