import board
from adafruit_pyportal import PyPortal
# Get wifi details and more from a secrets.py file
try:
from test_secrets import secrets
except ImportError:
print("WiFi secrets are kept in secrets.py, please add them there!")
raise
# Set a data source URL
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
# Create the PyPortal object
pyportal = PyPortal(url=TEXT_URL, status_neopixel=board.NEOPIXEL,secrets_data = secrets)
# Set display to show REPL
board.DISPLAY.show(None)
# Go get that data
print("Fetching text from", TEXT_URL)
data = pyportal.fetch()
# Print out what we got
print("-" * 40)
print(data)
print("-" * 40)
Refactor to work with the refactor fork of PortalBase to use
secrets_data
- https://github.com/adafruit/Adafruit_CircuitPython_PortalBase/pull/10