Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

tedder
Copy link
Contributor

@tedder tedder commented Jan 27, 2024

Shows the basic incantations to make it run in a cpython environment.

Shows the basic incantations to make it run in a cpython environment.
Copy link
Contributor

@michalpokusa michalpokusa left a 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
Copy link
Contributor

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
Copy link
Contributor

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.

@tedder
Copy link
Contributor Author

tedder commented Jan 27, 2024

@michalpokusa thanks! I'll do the feedback items, but yeah, would love you to do the document stuff in your PR.

@michalpokusa
Copy link
Contributor

@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.

@tedder
Copy link
Contributor Author

tedder commented Jan 28, 2024

great @michalpokusa , feel free to fold into your PR and I'll close this one.

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.

2 participants