-
Notifications
You must be signed in to change notification settings - Fork 51
Closed as not planned
Labels
bugSomething isn't workingSomething isn't working
Description
scratchattach version
2.1.13
What happened?
I have a code like this: (code)
And the outcome was like this: (traceback)
Can anyone tell the error??
(This worked perfectly fine when it isn't up to date)
Your code.
import scratchattach as sa
from scratchattach import Database
db1 = Database("pollencodedstorage", json_file_path="pollencodedstorage.json", save_interval=10) # save_interval specifies the wait time between the automated saves to the JSON file
db2 = Database("userstats", json_file_path="userstats.json", save_interval=10) # save_interval specifies the wait time between the automated saves to the JSON file
db3 = Database("accesscode", json_file_path="accesscode.json", save_interval=10) # save_interval specifies the wait time between the automated saves to the JSON file
session = sa.login_by_id("session_id", username="username") #replace with your session_id and username
cloud = session.connect_cloud("project_id")
storage = cloud.storage()
storage.add_database(db1)
storage.add_database(db2)
storage.add_database(db3)
def set(argument1, argument2):
storage.set({argument1}, {argument2}, {argument2})
def get(agrument1, argument2):
storage.get({argument1}, {argument2})
def keys(argument1):
storage.keys({argmuent1})
def delete(argument1, argument2):
storage.delete({argument1}, {argument2})
@storage.request(name="delete")
def delete_request(argument1, argument2):
del storage.get_database(argument1).data[argument2]
storage.start()
Traceback
Server marked as running
Python 3.11.13
container~ if [[ -d .git ]] && [[ "${AUTO_UPDATE}" == "1" ]]; then git pull; fi; if [[ ! -z "${PY_PACKAGES}" ]]; then pip install -U --prefix .local ${PY_PACKAGES}; fi; if [[ -f /home/container/${REQUIREMENTS_FILE} ]]; then pip install -U --prefix .local -r ${REQUIREMENTS_FILE}; fi; /usr/local/bin/python /home/container/${PY_FILE}
Requirement already satisfied: scratchattach in ./.local/lib/python3.11/site-packages (2.1.13)
Requirement already satisfied: websocket-client in ./.local/lib/python3.11/site-packages (from scratchattach) (1.8.0)
Requirement already satisfied: requests in ./.local/lib/python3.11/site-packages (from scratchattach) (2.32.5)
Requirement already satisfied: bs4 in ./.local/lib/python3.11/site-packages (from scratchattach) (0.0.2)
Requirement already satisfied: SimpleWebSocketServer in ./.local/lib/python3.11/site-packages (from scratchattach) (0.1.2)
Requirement already satisfied: typing-extensions in ./.local/lib/python3.11/site-packages (from scratchattach) (4.15.0)
Requirement already satisfied: beautifulsoup4 in ./.local/lib/python3.11/site-packages (from bs4->scratchattach) (4.13.5)
Requirement already satisfied: charset_normalizer<4,>=2 in ./.local/lib/python3.11/site-packages (from requests->scratchattach) (3.4.3)
Requirement already satisfied: idna<4,>=2.5 in ./.local/lib/python3.11/site-packages (from requests->scratchattach) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./.local/lib/python3.11/site-packages (from requests->scratchattach) (2.5.0)
Requirement already satisfied: certifi>=2017.4.17 in ./.local/lib/python3.11/site-packages (from requests->scratchattach) (2025.8.3)
Requirement already satisfied: soupsieve>1.2 in ./.local/lib/python3.11/site-packages (from beautifulsoup4->bs4->scratchattach) (2.8)
[notice] A new release of pip is available: 24.0 -> 25.2
[notice] To update, run: pip install --upgrade pip
/home/container/.local/lib/python3.11/site-packages/scratchattach/site/session.py:1007: LoginDataWarning: IMPORTANT: If you included login credentials directly in your code (e.g. session_id, session_string, ...), then make sure to EITHER instead load them from environment variables or files OR remember to remove them before you share your code with anyone else. If you want to remove this warning, use `warnings.filterwarnings('ignore', category=scratchattach.LoginDataWarning)`
warnings.warn(
Traceback (most recent call last):
File "/home/container/app.py", line 10, in
storage = cloud.storage()
^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/scratchattach/cloud/_base.py", line 105, in storage
return CloudStorage(self, used_cloud_vars=used_cloud_vars, no_packet_loss=no_packet_loss)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/scratchattach/eventhandlers/cloud_storage.py", line 86, in __init__
super().__init__(cloud, used_cloud_vars=used_cloud_vars, no_packet_loss=no_packet_loss)
File "/home/container/.local/lib/python3.11/site-packages/scratchattach/eventhandlers/cloud_requests.py", line 67, in __init__
super().__init__(cloud)
File "/home/container/.local/lib/python3.11/site-packages/scratchattach/eventhandlers/cloud_events.py", line 19, in __init__
self.source_stream = cloud.create_event_stream()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/scratchattach/cloud/_base.py", line 442, in create_event_stream
self.event_stream = WebSocketEventStream(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/scratchattach/cloud/_base.py", line 125, in __init__
self.source_cloud.connect()
File "/home/container/.local/lib/python3.11/site-packages/scratchattach/cloud/cloud.py", line 29, in connect
super().connect()
File "/home/container/.local/lib/python3.11/site-packages/scratchattach/cloud/_base.py", line 305, in connect
self.websocket.connect(
File "/home/container/.local/lib/python3.11/site-packages/websocket/_core.py", line 261, in connect
self.handshake_response = handshake(self.sock, url, *addrs, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/websocket/_handshake.py", line 65, in handshake
status, resp = _get_resp_headers(sock)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.11/site-packages/websocket/_handshake.py", line 150, in _get_resp_headers
raise WebSocketBadStatusException(
websocket._exceptions.WebSocketBadStatusException: Handshake status 502 Bad Gateway -+-+- {'date': 'Thu, 25 Sep 2025 14:24:58 GMT', 'content-type': 'text/html', 'content-length': '157', 'connection': 'keep-alive', 'server': 'nginx/1.22.1'} -+-+- b'\r\n\r\n\r\n
502 Bad Gateway
\r\n
nginx/1.22.1
\r\n\r\n\r\n'
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working