Skip to content

fix .server_state() attribute name #131

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 2 commits into from
Dec 7, 2021
Merged

fix .server_state() attribute name #131

merged 2 commits into from
Dec 7, 2021

Conversation

anecdata
Copy link
Member

@anecdata anecdata commented Mar 26, 2021

AttributeError: 'ESP_SPIcontrol' object has no attribute 'get_server_state'

```
...
socket.set_interface(esp)
ss = socket.socket()
esp.start_server(PORT, ss.socknum)
print("Server status: ", esp.server_state(ss.socknum))
print("Server status: ", esp.get_server_state(ss.socknum))
```
yields
```
Server status:  1
Traceback (most recent call last):
  File "code.py", line 76, in <module>
AttributeError: 'ESP_SPIcontrol' object has no attribute 'get_server_state'
```
@ladyada ladyada requested a review from brentru March 26, 2021 22:48
@anecdata anecdata changed the title fix .server_state()attribute name fix .server_state() attribute name Mar 27, 2021
@anecdata
Copy link
Member Author

I'm not actively working on WSGIServer, but noticed this when looking at it to make a simple TCP socket server example.

@anecdata anecdata marked this pull request as ready for review March 27, 2021 20:01
@jposada202020
Copy link
Contributor

@anecdata :) could you guide me in how to test this, I have the hardware2 but my network knowledge is not au-pair. If you have some basic test code I could replicate. Let me know thanks

@anecdata
Copy link
Member Author

anecdata commented May 13, 2021

@jposada202020 There is an example, I've only run it once:
https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/tree/master/examples/server
Should run on any ESP32SPI configuration (PyPortal, M4+Airlift, etc.)

Once it's running, any web client can load the web page, the server will print out its IP address, and the port is 80.

If you want, here or on Discord, I can set it up in parallel with you and step through it since I'm a little hazy on it now.

@anecdata
Copy link
Member Author

Oh yeah, and in line 232 of the example, you have to turn debug on to exercise the PR change:
wsgiServer = server.WSGIServer(80, application=web_app, debug=True)

@jposada202020
Copy link
Contributor

This was tested, and it works as described

Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Adafruit PyPortal Titano with samd51j20
>>> import esp32spi_wsgiserver
ESP32 SPI simple web server test!


open this IP in your browser:  192.168.2.68
Server available at 192.168.2.68:80
Sever status:  1

We have a long discussion over the #help-with-circuitpython-channel during our testing, if anyone is interested in this
@brentru coud you take a look. Thanks

@evaherrada evaherrada changed the base branch from master to main June 7, 2021 18:50
@JayToltTech
Copy link

JayToltTech commented Dec 5, 2021

FYI, just hit this myself, looking into the example code of how to implement a simple socket server with Featherwing Airlift... I looked at the PR and lgtm @ladyada @brentru.

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as well.

Tested successfully on:

Adafruit CircuitPython 7.1.0-beta.0 on 2021-11-12; Adafruit PyPortal with samd51j20
Board ID:pyportal

@FoamyGuy FoamyGuy merged commit de4829a into main Dec 7, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 8, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.5.13 from 3.5.12:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#131 from adafruit/anecdata-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#145 from dhalbert/make-package
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_RTTTL to 2.4.9 from 2.4.8:
  > Merge pull request adafruit/Adafruit_CircuitPython_RTTTL#27 from FoamyGuy/typing_fix
  > update rtd py version

Updating https://github.com/adafruit/Adafruit_CircuitPython_Slideshow to 1.7.2 from 1.7.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_Slideshow#41 from dhalbert/OnDiskBitmap-filename
  > update rtd py version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants