Skip to content

Migrating to v2

Tim edited this page Oct 20, 2024 · 11 revisions

Scratchattach v2 is not backwards compatible. But upgrading is worth it, because it comes with many new features.

This page lists the main non-backwards-compatible changes to make it easier for you to upgrade. If you're running into unexpected errors, check the documentation to find out how the specific feature works in scratchattach v2.

  1. Generally, scratchattach is now imported as / referenced as sa (no longer as scratch3) in the docs.
  2. session = scratch3.Session("session_id") was changed to session = sa.login_by_id("session_id")
  3. events = scratch3.CloudEvents("project_id") was changed to events = sa.get_cloud("project_id").events()`
  4. client = scratch3.CloudRequests(conn) was changed to client = session.connect_cloud("project_id").requests()`
  5. value = scratch3.get_var("project_id", "variable") was changed to
cloud = sa.get_cloud("project_id")
value = cloud.get_var("project_id")

The same applies to getting TurboWarp cloud variables. 6. All comments are now represented by sa.Comment objects 7. All activites and messages are now represented by sa.Activity objects 8. Projects and studios are now always represented by sa.Project and sa.Studio objects, never as dicts 9. project.get_comment was changed to project.comment_by_id 10. Generally, many functions that used to start with ".get_" had the "get_" removed from their names. 11. If an attribute refers to a username, it is now always ".username" and not ".user"

Clone this wiki locally