-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path__init__.py
More file actions
30 lines (24 loc) · 881 Bytes
/
__init__.py
File metadata and controls
30 lines (24 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import logging
log = logging.getLogger("socketdev")
class AuditLog:
def __init__(self, api):
self.api = api
def get(self, org_slug: str, **kwargs) -> dict:
"""
Get audit log entries for an organization.
Args:
org_slug: Organization slug
**kwargs: Query parameters like limit, cursor, etc.
Returns:
dict: API response containing audit log entries
"""
path = f"orgs/{org_slug}/audit-log"
if kwargs:
from urllib.parse import urlencode
path += "?" + urlencode(kwargs)
response = self.api.do_request(path=path)
if response.status_code == 200:
return response.json()
log.error(f"Error getting audit log: {response.status_code}")
log.error(response.text)
return {"results": []}