3
3
from enum import Enum
4
4
from typing import Any , Dict , List , Optional , Union
5
5
from dataclasses import dataclass , asdict , field
6
-
6
+ import urllib . parse
7
7
8
8
from ..utils import IntegrationType , Utils
9
9
@@ -702,24 +702,10 @@ class FullScans:
702
702
def __init__ (self , api ):
703
703
self .api = api
704
704
705
- def create_params_string (self , params : dict ) -> str :
706
- param_str = ""
707
-
708
- for name , value in params .items ():
709
- if value :
710
- if name == "committers" and isinstance (value , list ):
711
- for committer in value :
712
- param_str += f"&{ name } ={ committer } "
713
- else :
714
- param_str += f"&{ name } ={ value } "
715
-
716
- param_str = "?" + param_str .lstrip ("&" )
717
-
718
- return param_str
719
705
720
706
def get (self , org_slug : str , params : dict , use_types : bool = False ) -> Union [dict , GetFullScanMetadataResponse ]:
721
- params_arg = self . create_params_string (params )
722
- path = "orgs/" + org_slug + "/full-scans" + str (params_arg )
707
+ params_arg = urllib . parse . urlencode (params )
708
+ path = "orgs/" + org_slug + "/full-scans? " + str (params_arg )
723
709
response = self .api .do_request (path = path )
724
710
725
711
if response .status_code == 200 :
@@ -741,10 +727,8 @@ def post(self, files: list, params: FullScanParams, use_types: bool = False) ->
741
727
org_slug = str (params .org_slug )
742
728
params_dict = params .to_dict ()
743
729
params_dict .pop ("org_slug" )
744
-
745
- params_arg = self .create_params_string (params_dict )
746
-
747
- path = "orgs/" + org_slug + "/full-scans" + str (params_arg )
730
+ params_arg = urllib .parse .urlencode (params_dict )
731
+ path = "orgs/" + org_slug + "/full-scans?" + str (params_arg )
748
732
749
733
response = self .api .do_request (path = path , method = "POST" , files = files )
750
734
0 commit comments