Skip to content

Commit ebcb723

Browse files
authored
Merge pull request #7 from brentru/expose-requests-more
Add more HTTP request types to WiFiManager
2 parents daa8dab + ef08587 commit ebcb723

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

adafruit_esp32spi/adafruit_esp32spi_wifimanager.py

+57
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,63 @@ def post(self, url, **kw):
118118
self.neo_status(0)
119119
return return_val
120120

121+
def put(self, url, **kw):
122+
"""
123+
Pass the put request to requests and update Status NeoPixel
124+
125+
:param str url: The URL to PUT data to
126+
:param dict data: (Optional) Form data to submit
127+
:param dict json: (Optional) JSON data to submit. (Data must be None)
128+
:param dict header: (Optional) Header data to include
129+
:param bool stream: (Optional) Whether to stream the Response
130+
:return: The response from the request
131+
:rtype: Response
132+
"""
133+
if not self._esp.is_connected:
134+
self.connect()
135+
self.neo_status((100, 100, 0))
136+
return_val = requests.put(url, **kw)
137+
self.neo_status(0)
138+
return return_val
139+
140+
def patch(self, url, **kw):
141+
"""
142+
Pass the patch request to requests and update Status NeoPixel
143+
144+
:param str url: The URL to PUT data to
145+
:param dict data: (Optional) Form data to submit
146+
:param dict json: (Optional) JSON data to submit. (Data must be None)
147+
:param dict header: (Optional) Header data to include
148+
:param bool stream: (Optional) Whether to stream the Response
149+
:return: The response from the request
150+
:rtype: Response
151+
"""
152+
if not self._esp.is_connected:
153+
self.connect()
154+
self.neo_status((100, 100, 0))
155+
return_val = requests.patch(url, **kw)
156+
self.neo_status(0)
157+
return return_val
158+
159+
def delete(self, url, **kw):
160+
"""
161+
Pass the delete request to requests and update Status NeoPixel
162+
163+
:param str url: The URL to PUT data to
164+
:param dict data: (Optional) Form data to submit
165+
:param dict json: (Optional) JSON data to submit. (Data must be None)
166+
:param dict header: (Optional) Header data to include
167+
:param bool stream: (Optional) Whether to stream the Response
168+
:return: The response from the request
169+
:rtype: Response
170+
"""
171+
if not self._esp.is_connected:
172+
self.connect()
173+
self.neo_status((100, 100, 0))
174+
return_val = requests.delete(url, **kw)
175+
self.neo_status(0)
176+
return return_val
177+
121178
def ping(self, host, ttl=250):
122179
"""
123180
Pass the Ping request to the ESP32, update Status NeoPixel, return response time

0 commit comments

Comments
 (0)