-
Notifications
You must be signed in to change notification settings - Fork 4
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 support for WIZNET5K ssl #9
Conversation
bcb85fd
to
b60cba1
Compare
@anecdata if you have time, would you be willing to try this? |
I'm having trouble getting the right pieces together for this. Here's what's installed: code...import traceback
import ssl
import board
import digitalio
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_requests
import adafruit_connection_manager
TEXT_URL = "https://httpbin.org/get"
spi_bus = board.SPI()
cs = digitalio.DigitalInOut(board.A4)
mac = f'de:ad:be:ef:fe:{(252):02x}' # I need this to avoid DHCP collisions
radio = WIZNET5K(spi_bus, cs, mac=mac, debug=False)
pool = adafruit_connection_manager.get_radio_socketpool(radio)
ssl_context = adafruit_connection_manager.get_radio_ssl_context(radio)
requests = adafruit_requests.Session(pool, ssl_context)
while True:
print(f"Fetching from {TEXT_URL} ... ", end="")
with requests.get(TEXT_URL) as resp:
print(f'{resp.status_code}')
time.sleep(5) result:
I haven't used CM too much yet, maybe there's something wrong in the code. |
@anecdata I found the issue (working on too many things at the same time). I'll update this PR tonight |
Yes, I fully understand, there are so many inter-related changes going on, it's hard to keep track of what goes with what. |
Especially when it's one's own fault. I keep doing things here like I do professionally and thinking things will get merged and released quickly... |
@anecdata this should work now... Sorry about that |
That did it... "200 OK" every 5 seconds :-) |
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.
Not tested. Just one style thing.
Co-authored-by: Dan Halbert <halbert@halwitz.org>
@dhalbert updated |
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.
Thanks!
Updating https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager to 1.1.0 from 1.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_ConnectionManager#8 from justmobilize/different-pool-different-connection-manager > Merge pull request adafruit/Adafruit_CircuitPython_ConnectionManager#9 from justmobilize/wiznet5k-ssl > Merge pull request adafruit/Adafruit_CircuitPython_ConnectionManager#12 from justmobilize/test-updates > Merge pull request adafruit/Adafruit_CircuitPython_ConnectionManager#5 from FoamyGuy/fix_circup_instruction Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
Updated to support SSL everywhere. To test you need:
cp: main
adafruit/circuitpython#8954 (merged)wiznet: main
adafruit/Adafruit_CircuitPython_Wiznet5k#157 (merged)If this looks good to people (and once the versions are determined), I would like to add tests before it's merged.