Skip to content

Commit da4b012

Browse files
committed
Fix for making some repo fields optional to reduce chance of failure if they go missing
1 parent 0f3394e commit da4b012

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

socketdev/repos/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ def to_dict(self):
3030
def from_dict(cls, data: dict) -> "RepositoryInfo":
3131
return cls(
3232
id=data["id"],
33-
created_at=data["created_at"],
34-
updated_at=data["updated_at"],
35-
head_full_scan_id=data["head_full_scan_id"],
33+
created_at=data.get("created_at", ""),
34+
updated_at=data.get("updated_at", ""),
35+
head_full_scan_id=data.get("head_full_scan_id", ""),
3636
name=data["name"],
37-
description=data["description"],
38-
homepage=data["homepage"],
39-
visibility=data["visibility"],
40-
archived=data["archived"],
41-
default_branch=data["default_branch"],
42-
slug=data.get("slug"),
37+
description=data.get("description", ""),
38+
homepage=data.get("homepage", ""),
39+
visibility=data.get("visibility", "private"),
40+
archived=data.get("archived", False),
41+
default_branch=data.get("default_branch", "main"),
42+
slug=data["slug"]
4343
)
4444

4545

0 commit comments

Comments
 (0)