Hosting
To run your Python code 24/7, you will need to host it.
-
We recommend ScratchHost for this purpose.
ScratchHost is a community-created hosting platform (not affiliated with scratchattach or the Scratch team).
+
In the wiki, you can find a list of recommended hosting services that can be used for this purpose.
-
-
+
From 722e1705d906c60a9575aa486cdd0059a7dd2f7c Mon Sep 17 00:00:00 2001
From: Tim <53166177+TimMcCool@users.noreply.github.com>
Date: Sat, 21 Dec 2024 19:51:07 +0100
Subject: [PATCH 089/101] fixed small typo
---
scratchattach/site/session.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scratchattach/site/session.py b/scratchattach/site/session.py
index c13dc3a7..55cf7266 100644
--- a/scratchattach/site/session.py
+++ b/scratchattach/site/session.py
@@ -54,7 +54,7 @@ class Session(BaseSiteComponent):
'''
def __str__(self):
- return "Login for account: {self.username}"
+ return f"Login for account: {self.username}"
def __init__(self, **entries):
From bbd83e1456dd3c62e5b97a57ad8d5e784e0f058d Mon Sep 17 00:00:00 2001
From: Tim <53166177+TimMcCool@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:13:10 +0100
Subject: [PATCH 090/101] .
---
.gitignore | 1 +
CHANGELOG.md | 5 +++++
setup.py | 2 +-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 90542664..4de6878c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ scratchattach/test.py
scratchattach.code-workspace
**/.DS_Store
setup.py
+setup.py
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb9e1f03..0328f2ea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+# 2.1.7
+
+- Fixed self-hosting TW cloud ws servers feature
+- Added sa.translate and sa.text2speech functions
+
# 2.0.6
Cloud variables: Stability improvement
diff --git a/setup.py b/setup.py
index 3e3df4d7..0e5a4d51 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
import codecs
import os
-VERSION = '2.1.6'
+VERSION = '2.1.7'
DESCRIPTION = 'A Scratch API Wrapper'
LONG_DESCRIPTION = DESCRIPTION
From 17ac00f2783f47e8a67e9bd4f352f786fade4503 Mon Sep 17 00:00:00 2001
From: Tim <53166177+TimMcCool@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:21:21 +0100
Subject: [PATCH 091/101] .
---
scratchattach/site/session.py | 1 +
scratchattach/utils/requests.py | 5 +++--
setup.py | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/scratchattach/site/session.py b/scratchattach/site/session.py
index 55cf7266..5b278f86 100644
--- a/scratchattach/site/session.py
+++ b/scratchattach/site/session.py
@@ -839,6 +839,7 @@ def login(username, password, *, timeout=10) -> Session:
request = requests.post(
"https://scratch.mit.edu/login/", data=data, headers=_headers,
timeout = timeout,
+ errorhandling = False
)
try:
session_id = str(re.search('"(.*)"', request.headers["Set-Cookie"]).group())
diff --git a/scratchattach/utils/requests.py b/scratchattach/utils/requests.py
index 1c90a749..f772db04 100644
--- a/scratchattach/utils/requests.py
+++ b/scratchattach/utils/requests.py
@@ -31,12 +31,13 @@ def get(url, *, data=None, json=None, headers=None, cookies=None, timeout=None,
return r
@staticmethod
- def post(url, *, data=None, json=None, headers=None, cookies=None, timeout=None, params=None):
+ def post(url, *, data=None, json=None, headers=None, cookies=None, timeout=None, params=None, errorhandling=True):
try:
r = requests.post(url, data=data, json=json, headers=headers, cookies=cookies, params=params, timeout=timeout, proxies=proxies)
except Exception as e:
raise exceptions.FetchError(e)
- Requests.check_response(r)
+ if errorhandling:
+ Requests.check_response(r)
return r
@staticmethod
diff --git a/setup.py b/setup.py
index 0e5a4d51..12ee2976 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
import codecs
import os
-VERSION = '2.1.7'
+VERSION = '2.1.8'
DESCRIPTION = 'A Scratch API Wrapper'
LONG_DESCRIPTION = DESCRIPTION
From 52853ce9ed58d02966db4d3e34b27afa78750290 Mon Sep 17 00:00:00 2001
From: Tim <53166177+TimMcCool@users.noreply.github.com>
Date: Sun, 22 Dec 2024 14:25:12 +0100
Subject: [PATCH 092/101] .
---
scratchattach/cloud/_base.py | 4 ++--
setup.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scratchattach/cloud/_base.py b/scratchattach/cloud/_base.py
index f3076ed7..1bf4a98e 100644
--- a/scratchattach/cloud/_base.py
+++ b/scratchattach/cloud/_base.py
@@ -48,10 +48,10 @@ class BaseCloud(ABC):
:self.print_connect_messages: Whether to print a message on every connect to the cloud server. Defaults to False.
"""
- def __init__(self):
+ def __init__(self, *, _session=None):
# Required internal attributes that every object representing a cloud needs to have (no matter what cloud is represented):
- self._session = None
+ self._session = _session
self.active_connection = False #whether a connection to a cloud variable server is currently established
self.websocket = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE})
self.recorder = None # A CloudRecorder object that records cloud activity for the values to be retrieved later will be saved in this attribute as soon as .get_var is called
diff --git a/setup.py b/setup.py
index 12ee2976..cc2d7469 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
import codecs
import os
-VERSION = '2.1.8'
+VERSION = '2.1.9'
DESCRIPTION = 'A Scratch API Wrapper'
LONG_DESCRIPTION = DESCRIPTION
From c0f2ee8dfdd569d5dcdb2c78e40b012ce55382b4 Mon Sep 17 00:00:00 2001
From: "."