-
Notifications
You must be signed in to change notification settings - Fork 31
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
add cpython example #77
Conversation
Shows the basic incantations to make it run in a cpython environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example indeed works. Would be nice to include it in docs and ":emphasize-lines:" CPython related differences (to be consistent). If you want I can include that in my open PR.
# Simple example showing how to use httpserver in cpython (e.g., on a computer). | ||
|
||
import socket | ||
from adafruit_httpserver import Server, Request, Response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every other example has a blank line between general imports and adafruit_httpserver
imports
|
||
|
||
# fake the wifi class, reduces changes required later in the code. | ||
class wifi: # pylint: disable=too-few-public-methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is not necessary to create such class, I believe simply passing "0.0.0.0"
as argument to server.serve_forever()
is enough. The only reason other examples use wifi.radio.ipv4_address
is because this is the way CircuitPython handles that.
@michalpokusa thanks! I'll do the feedback items, but yeah, would love you to do the document stuff in your PR. |
In this case, if it's okay with you, you can skip changing your PR, I will include both example and docs for it in my PR, so it will all go in a single one, instead of one depending on another. |
great @michalpokusa , feel free to fold into your PR and I'll close this one. |
Shows the basic incantations to make it run in a cpython environment.