Skip to content

Remove secrets #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

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions examples/pastebin_aio_cpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
#
# SPDX-License-Identifier: Unlicense

from os import getenv
import ssl
import socket
import adafruit_requests as requests
from adafruit_pastebin.adafruit_io import AIOPastebin

try:
from secrets import secrets
except ImportError:
print("Please place your auth/dev key in a secrets.py file!")
raise

auth_key = secrets["auth_key"]
# Get PasteBin keys, ensure these are setup in your environment
auth_key = getenv("auth_key")

session = requests.Session(socket, ssl_context=ssl.create_default_context())

Expand Down
10 changes: 3 additions & 7 deletions examples/pastebin_gist_cpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
#
# SPDX-License-Identifier: Unlicense

from os import getenv
import ssl
import socket
import adafruit_requests as requests
from adafruit_pastebin.gist import Gist

try:
from secrets import secrets
except ImportError:
print("Please place your auth/dev key in a secrets.py file!")
raise

auth_key = secrets["auth_key"]
# Get PasteBin keys, ensure these are setup in your environment
auth_key = getenv("auth_key")

session = requests.Session(socket, ssl_context=ssl.create_default_context())

Expand Down
14 changes: 6 additions & 8 deletions examples/pastebin_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@
#
# SPDX-License-Identifier: Unlicense

from os import getenv
import ssl
import wifi
import socketpool
import adafruit_requests as requests
from adafruit_pastebin.pastebin import PasteBin, ExpirationSetting, PrivacySetting

try:
from secrets import secrets
except ImportError:
print("Please place your auth/dev key in a secrets.py file!")
raise
# Get WiFi details and PasteBin keys, ensure these are setup in settings.toml
ssid = getenv("CIRCUITPY_WIFI_SSID")
password = getenv("CIRCUITPY_WIFI_PASSWORD")
auth_key = getenv("auth_key")

wifi.radio.connect(secrets["ssid"], secrets["password"])
wifi.radio.connect(ssid, password)
pool = socketpool.SocketPool(wifi.radio)
session = requests.Session(pool, ssl.create_default_context())

auth_key = secrets["auth_key"]

pastebin = PasteBin(session, auth_key)
paste_url = pastebin.paste(
"This is a test paste!",
Expand Down
10 changes: 3 additions & 7 deletions examples/pastebin_simpletest_cpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@
#
# SPDX-License-Identifier: Unlicense

from os import getenv
import ssl
import socket
import adafruit_requests as requests
from adafruit_pastebin.pastebin import PasteBin, ExpirationSetting, PrivacySetting

try:
from secrets import secrets
except ImportError:
print("Please place your auth/dev key in a secrets.py file!")
raise

auth_key = secrets["auth_key"]
# Get PasteBin keys, ensure these are setup in your environment
auth_key = getenv("auth_key")

session = requests.Session(socket, ssl_context=ssl.create_default_context())

Expand Down