Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion socketdev/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def do_request(
if headers is None:
headers = {
"Authorization": f"Basic {self.encoded_key}",
"User-Agent": f"SocketPythonScript/{__version__}",
"User-Agent": f"SocketSDKPython/{__version__}",
"accept": "application/json",
}
url = f"{self.api_url}/{path}"
Expand Down
26 changes: 5 additions & 21 deletions socketdev/fullscans/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union
from dataclasses import dataclass, asdict, field

import urllib.parse

from ..utils import IntegrationType, Utils

Expand Down Expand Up @@ -702,24 +702,10 @@ class FullScans:
def __init__(self, api):
self.api = api

def create_params_string(self, params: dict) -> str:
param_str = ""

for name, value in params.items():
if value:
if name == "committers" and isinstance(value, list):
for committer in value:
param_str += f"&{name}={committer}"
else:
param_str += f"&{name}={value}"

param_str = "?" + param_str.lstrip("&")

return param_str

def get(self, org_slug: str, params: dict, use_types: bool = False) -> Union[dict, GetFullScanMetadataResponse]:
params_arg = self.create_params_string(params)
path = "orgs/" + org_slug + "/full-scans" + str(params_arg)
params_arg = urllib.parse.urlencode(params)
path = "orgs/" + org_slug + "/full-scans?" + str(params_arg)
response = self.api.do_request(path=path)

if response.status_code == 200:
Expand All @@ -741,10 +727,8 @@ def post(self, files: list, params: FullScanParams, use_types: bool = False) ->
org_slug = str(params.org_slug)
params_dict = params.to_dict()
params_dict.pop("org_slug")

params_arg = self.create_params_string(params_dict)

path = "orgs/" + org_slug + "/full-scans" + str(params_arg)
params_arg = urllib.parse.urlencode(params_dict)
path = "orgs/" + org_slug + "/full-scans?" + str(params_arg)

response = self.api.do_request(path=path, method="POST", files=files)

Expand Down
2 changes: 1 addition & 1 deletion socketdev/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.11"
__version__ = "2.0.13"
Loading