Skip to content
Merged
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: 5 additions & 5 deletions scratchattach/site/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import warnings
import zipfile
from io import BytesIO
from typing import Callable, Union
from typing import Callable, Union, cast

from dataclasses import dataclass, field
from typing import Any, Optional
Expand Down Expand Up @@ -185,11 +185,11 @@ def is_shared(self):
Returns:
boolean: Returns whether the project is currently shared
"""
try:
p = get_project(self.id)
return isinstance(p, Project)
except exceptions.ProjectNotFound:
response = requests.get(f"https://api.scratch.mit.edu/projects/{self.id}")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use self.update_api and self.update_method here although this isn't technically an update method so maybe it should be decoupled. But this is fine

if response.status_code == 404:
return False
response_json = cast(ProjectDict, response.json())
return response_json["is_published"]

def raw_json_or_empty(self) -> dict[str, Any]:
return empty_project_json
Expand Down
Loading