Skip to content

Commit

Permalink
Fixed the panther example (#5)
Browse files Browse the repository at this point in the history
* Fixed the panther example

* Added timeout

* Removing cache file
  • Loading branch information
dacoburn authored Dec 29, 2023
1 parent 2705a95 commit 4d70cbc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions core/socket_reports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Reports:
column_names: list
api_key: str
owner: str
timeout: int
start_date: str
report_id: str

Expand All @@ -26,6 +27,7 @@ def __init__(
org: str,
api_key: str,
start_date: str = None,
timeout: int = 20,
report_id: str = None
):
self.base_url = f"https://socket.dev/dashboard/org/gh/{org}/reports?"
Expand All @@ -40,7 +42,8 @@ def __init__(
self.db = SqliteDB(column_names=self.column_names)
global socket
socket = SocketDev(
token=api_key
token=api_key,
request_timeout=timeout
)

def check_if_reports_exist(self, reports: list) -> list:
Expand Down Expand Up @@ -199,9 +202,11 @@ def process_report(
record: Report,
records: list
) -> (list, bool):
base_url = "https://api.socket.dev/v0"
record_url = f"{base_url}/report/view/{record.id}"
report_json = Reports.pull_report(
record.id,
record.url
record_url
)
if report_json is None:
return records, False
Expand Down
Binary file removed reports.db
Binary file not shown.
2 changes: 1 addition & 1 deletion socket-integration-example.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
)
for issue in issue_data:
issue_json = json.loads(str(issue))
panther.send_to_webhook(str(issue))
panther.send(str(issue))
print(f"Processed issue id: {issue.id}")

# Webhook Example
Expand Down

0 comments on commit 4d70cbc

Please sign in to comment.