Skip to content

Add more HTTP request types to WiFiManager #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions adafruit_esp32spi/adafruit_esp32spi_wifimanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,63 @@ def post(self, url, **kw):
self.neo_status(0)
return return_val

def put(self, url, **kw):
"""
Pass the put request to requests and update Status NeoPixel

:param str url: The URL to PUT data to
:param dict data: (Optional) Form data to submit
:param dict json: (Optional) JSON data to submit. (Data must be None)
:param dict header: (Optional) Header data to include
:param bool stream: (Optional) Whether to stream the Response
:return: The response from the request
:rtype: Response
"""
if not self._esp.is_connected:
self.connect()
self.neo_status((100, 100, 0))
return_val = requests.put(url, **kw)
self.neo_status(0)
return return_val

def patch(self, url, **kw):
"""
Pass the patch request to requests and update Status NeoPixel

:param str url: The URL to PUT data to
:param dict data: (Optional) Form data to submit
:param dict json: (Optional) JSON data to submit. (Data must be None)
:param dict header: (Optional) Header data to include
:param bool stream: (Optional) Whether to stream the Response
:return: The response from the request
:rtype: Response
"""
if not self._esp.is_connected:
self.connect()
self.neo_status((100, 100, 0))
return_val = requests.patch(url, **kw)
self.neo_status(0)
return return_val

def delete(self, url, **kw):
"""
Pass the delete request to requests and update Status NeoPixel

:param str url: The URL to PUT data to
:param dict data: (Optional) Form data to submit
:param dict json: (Optional) JSON data to submit. (Data must be None)
:param dict header: (Optional) Header data to include
:param bool stream: (Optional) Whether to stream the Response
:return: The response from the request
:rtype: Response
"""
if not self._esp.is_connected:
self.connect()
self.neo_status((100, 100, 0))
return_val = requests.delete(url, **kw)
self.neo_status(0)
return return_val

def ping(self, host, ttl=250):
"""
Pass the Ping request to the ESP32, update Status NeoPixel, return response time
Expand Down