Skip to content

Commit 73c4a56

Browse files
author
Melissa LeBlanc-Williams
committed
2 parents 4b56b54 + ebcb723 commit 73c4a56

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

adafruit_esp32spi/adafruit_esp32spi_wifimanager.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,63 @@ def post(self, url, **kw):
145145
self.neo_status(0)
146146
return return_val
147147

148+
def put(self, url, **kw):
149+
"""
150+
Pass the put request to requests and update Status NeoPixel
151+
152+
:param str url: The URL to PUT data to
153+
:param dict data: (Optional) Form data to submit
154+
:param dict json: (Optional) JSON data to submit. (Data must be None)
155+
:param dict header: (Optional) Header data to include
156+
:param bool stream: (Optional) Whether to stream the Response
157+
:return: The response from the request
158+
:rtype: Response
159+
"""
160+
if not self._esp.is_connected:
161+
self.connect()
162+
self.neo_status((100, 100, 0))
163+
return_val = requests.put(url, **kw)
164+
self.neo_status(0)
165+
return return_val
166+
167+
def patch(self, url, **kw):
168+
"""
169+
Pass the patch request to requests and update Status NeoPixel
170+
171+
:param str url: The URL to PUT data to
172+
:param dict data: (Optional) Form data to submit
173+
:param dict json: (Optional) JSON data to submit. (Data must be None)
174+
:param dict header: (Optional) Header data to include
175+
:param bool stream: (Optional) Whether to stream the Response
176+
:return: The response from the request
177+
:rtype: Response
178+
"""
179+
if not self._esp.is_connected:
180+
self.connect()
181+
self.neo_status((100, 100, 0))
182+
return_val = requests.patch(url, **kw)
183+
self.neo_status(0)
184+
return return_val
185+
186+
def delete(self, url, **kw):
187+
"""
188+
Pass the delete request to requests and update Status NeoPixel
189+
190+
:param str url: The URL to PUT data to
191+
:param dict data: (Optional) Form data to submit
192+
:param dict json: (Optional) JSON data to submit. (Data must be None)
193+
:param dict header: (Optional) Header data to include
194+
:param bool stream: (Optional) Whether to stream the Response
195+
:return: The response from the request
196+
:rtype: Response
197+
"""
198+
if not self._esp.is_connected:
199+
self.connect()
200+
self.neo_status((100, 100, 0))
201+
return_val = requests.delete(url, **kw)
202+
self.neo_status(0)
203+
return return_val
204+
148205
def ping(self, host, ttl=250):
149206
"""
150207
Pass the Ping request to the ESP32, update Status NeoPixel, return response time

0 commit comments

Comments
 (0)