Skip to content

Commit 2dd55a7

Browse files
committed
Remove secrets and more
1 parent eb3518a commit 2dd55a7

File tree

5 files changed

+18
-22
lines changed

5 files changed

+18
-22
lines changed

adafruit_pyportal/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ def __init__( # noqa: PLR0912,PLR0913,PLR0915 Too many branches,Too many argume
124124
esp=None,
125125
external_spi=None,
126126
debug=False,
127-
secrets_data=None,
128127
):
129128
graphics = Graphics(
130129
default_bg=default_bg,
@@ -161,7 +160,6 @@ def __init__( # noqa: PLR0912,PLR0913,PLR0915 Too many branches,Too many argume
161160
image_position=image_position,
162161
image_dim_json_path=image_dim_json_path,
163162
debug=debug,
164-
secrets_data=secrets_data,
165163
)
166164

167165
self.url = url

adafruit_pyportal/network.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def __init__( # noqa: PLR0913 Too many arguments in function definition
8383
image_resize=None,
8484
image_position=None,
8585
image_dim_json_path=None,
86-
secrets_data=None,
8786
):
8887
if status_neopixel:
8988
status_led = neopixel.NeoPixel(status_neopixel, 1, brightness=0.2)
@@ -95,7 +94,6 @@ def __init__( # noqa: PLR0913 Too many arguments in function definition
9594
wifi,
9695
extract_values=extract_values,
9796
debug=debug,
98-
secrets_data=secrets_data,
9997
)
10098

10199
self._convert_image = convert_image
@@ -113,16 +111,16 @@ def ip_address(self):
113111

114112
def image_converter_url(self, image_url, width, height, color_depth=16):
115113
"""Generate a converted image url from the url passed in,
116-
with the given width and height. aio_username and aio_key must be
117-
set in secrets."""
114+
with the given width and height. ADAFRUIT_AIO_USERNAME and
115+
ADAFRUIT_AIO_KEY must be set in settings.toml."""
118116
try:
119-
aio_username = self._get_setting("AIO_USERNAME")
120-
aio_key = self._get_setting("AIO_KEY")
117+
aio_username = self._get_setting("ADAFRUIT_AIO_USERNAME")
118+
aio_key = self._get_setting("ADAFRUIT_AIO_KEY")
121119
except KeyError as error:
122120
raise KeyError(
123121
"\n\nOur image converter service require a login/password to rate-limit. "
124122
"Please register for a free adafruit.io account and place the user/key in "
125-
"your secrets file under 'aio_username' and 'aio_key'"
123+
"your settings.toml file under 'ADAFRUIT_AIO_USERNAME' and 'ADAFRUIT_AIO_KEY'"
126124
) from error
127125

128126
return IMAGE_CONVERTER_SERVICE % (

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"audiocore",
3838
"microcontroller",
3939
"neopixel",
40-
"secrets",
4140
"adafruit_sdcard",
4241
"storage",
4342
"sdcardio",

examples/pyportal_internet_json_fetching.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@
55
Example to illustrate the device capability to get json data
66
"""
77

8-
# NOTE: Make sure you've created your secrets.py file before running this example
9-
# https://learn.adafruit.com/adafruit-pyportal/internet-connect#whats-a-secrets-file-17-2
8+
# NOTE: Make sure you've created your settings.toml file before running this example
9+
# https://learn.adafruit.com/adafruit-pyportal/create-your-settings-toml-file
1010
import adafruit_connection_manager
1111
import adafruit_requests
1212
import board
1313
from adafruit_esp32spi import adafruit_esp32spi
1414
from digitalio import DigitalInOut
1515

16-
# Get wifi details and more from a secrets.py file
17-
try:
18-
from secrets import secrets
19-
except ImportError:
20-
print("WiFi secrets are kept in secrets.py, please add them there!")
21-
raise
16+
# Get wifi details and more from a settings.toml file
17+
# tokens used by this Demo: CIRCUITPY_WIFI_SSID, CIRCUITPY_WIFI_PASSWORD,
18+
# ADAFRUIT_AIO_USERNAME, ADAFRUIT_AIO_KEY
19+
ssid = getenv("CIRCUITPY_WIFI_SSID")
20+
password = getenv("CIRCUITPY_WIFI_PASSWORD")
21+
aio_username = getenv("ADAFRUIT_AIO_USERNAME")
22+
aio_key = getenv("ADAFRUIT_AIO_KEY")
2223

2324
print("ESP32 SPI webclient test")
2425

2526
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
26-
JSON_URL = "http://api.coindesk.com/v1/bpi/currentprice/USD.json"
27+
JSON_URL = "http://wifitest.adafruit.com/testwifi/sample.json"
2728

2829

2930
# ESP32 Pins:
@@ -49,7 +50,7 @@
4950
print("Connecting to AP...")
5051
while not esp.is_connected:
5152
try:
52-
esp.connect_AP(secrets["ssid"], secrets["password"])
53+
esp.connect_AP(ssid, password)
5354
except RuntimeError as e:
5455
print("could not connect to AP, retrying: ", e)
5556
continue

examples/pyportal_simpletest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#
33
# SPDX-License-Identifier: MIT
44

5-
# NOTE: Make sure you've created your secrets.py file before running this example
6-
# https://learn.adafruit.com/adafruit-pyportal/internet-connect#whats-a-secrets-file-17-2
5+
# NOTE: Make sure you've created your settings.toml file before running this example
6+
# https://learn.adafruit.com/adafruit-pyportal/create-your-settings-toml-file
77
import board
88
from displayio import CIRCUITPYTHON_TERMINAL
99

0 commit comments

Comments
 (0)