Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit38c636a

Browse files
chore: rename 'raw' to 'raw_post_data' in http_put/post/request
To minimize confusion with other usage of 'raw' in http_get, changename to 'raw_post_data' to signify if set that the 'post_data' will besent as raw data.
1 parentee13635 commit38c636a

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

‎gitlab/client.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -572,11 +572,11 @@ def _check_redirects(self, result: requests.Response) -> None:
572572
)
573573
)
574574

575+
@staticmethod
575576
def_prepare_send_data(
576-
self,
577577
files:Optional[Dict[str,Any]]=None,
578578
post_data:Optional[Union[Dict[str,Any],bytes]]=None,
579-
raw:bool=False,
579+
raw_post_data:bool=False,
580580
)->Tuple[
581581
Optional[Union[Dict[str,Any],bytes]],
582582
Optional[Union[Dict[str,Any],MultipartEncoder]],
@@ -599,7 +599,7 @@ def _prepare_send_data(
599599
data=MultipartEncoder(post_data)
600600
return (None,data,data.content_type)
601601

602-
ifrawandpost_data:
602+
ifraw_post_dataandpost_data:
603603
return (None,post_data,"application/octet-stream")
604604

605605
return (post_data,None,"application/json")
@@ -611,7 +611,7 @@ def http_request(
611611
path:str,
612612
query_data:Optional[Dict[str,Any]]=None,
613613
post_data:Optional[Union[Dict[str,Any],bytes]]=None,
614-
raw:bool=False,
614+
raw_post_data:bool=False,
615615
streamed:bool=False,
616616
files:Optional[Dict[str,Any]]=None,
617617
timeout:Optional[float]=None,
@@ -628,7 +628,7 @@ def http_request(
628628
query_data: Data to send as query parameters
629629
post_data: Data to send in the body (will be converted to
630630
json by default)
631-
raw: If True, do not convert post_data to json
631+
raw_post_data: If True, do not convert post_data to json
632632
streamed: Whether the data should be streamed
633633
files: The files to send to the server
634634
timeout: The timeout, in seconds, for the request
@@ -673,7 +673,9 @@ def http_request(
673673
timeout=opts_timeout
674674

675675
# We need to deal with json vs. data when uploading files
676-
json,data,content_type=self._prepare_send_data(files,post_data,raw)
676+
json,data,content_type=self._prepare_send_data(
677+
files,post_data,raw_post_data
678+
)
677679
opts["headers"]["Content-type"]=content_type
678680

679681
cur_retries=0
@@ -829,7 +831,7 @@ def http_post(
829831
path:str,
830832
query_data:Optional[Dict[str,Any]]=None,
831833
post_data:Optional[Dict[str,Any]]=None,
832-
raw:bool=False,
834+
raw_post_data:bool=False,
833835
files:Optional[Dict[str,Any]]=None,
834836
**kwargs:Any,
835837
)->Union[Dict[str,Any],requests.Response]:
@@ -862,6 +864,7 @@ def http_post(
862864
query_data=query_data,
863865
post_data=post_data,
864866
files=files,
867+
raw_post_data=raw_post_data,
865868
**kwargs,
866869
)
867870
try:
@@ -878,10 +881,10 @@ def http_put(
878881
path:str,
879882
query_data:Optional[Dict[str,Any]]=None,
880883
post_data:Optional[Union[Dict[str,Any],bytes]]=None,
881-
raw:bool=False,
884+
raw_post_data:bool=False,
882885
files:Optional[Dict[str,Any]]=None,
883886
**kwargs:Any,
884-
)->Union[Dict[str,Any],requests.Response]:
887+
)->Dict[str,Any]:
885888
"""Make a PUT request to the Gitlab server.
886889
887890
Args:
@@ -890,7 +893,7 @@ def http_put(
890893
query_data: Data to send as query parameters
891894
post_data: Data to send in the body (will be converted to
892895
json by default)
893-
raw: If True, do not convert post_data to json
896+
raw_post_data: If True, do not convert post_data to json
894897
files: The files to send to the server
895898
**kwargs: Extra options to send to the server (e.g. sudo)
896899
@@ -910,7 +913,7 @@ def http_put(
910913
query_data=query_data,
911914
post_data=post_data,
912915
files=files,
913-
raw=raw,
916+
raw_post_data=raw_post_data,
914917
**kwargs,
915918
)
916919
try:

‎gitlab/v4/objects/packages.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ def upload(
7777
raiseexc.GitlabUploadError(f"Failed to read package file{path}")
7878

7979
url=f"{self._computed_path}/{package_name}/{package_version}/{file_name}"
80-
server_data=self.gitlab.http_put(url,post_data=file_data,raw=True,**kwargs)
80+
server_data=self.gitlab.http_put(
81+
url,post_data=file_data,raw_post_data=True,**kwargs
82+
)
8183
ifTYPE_CHECKING:
8284
assertisinstance(server_data,dict)
8385

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp