Return values of post requests

This commit is contained in:
bom 2023-08-04 11:47:55 +02:00
parent 8d4921ea70
commit c02440ac65

View file

@ -213,7 +213,7 @@ class ArtifactDeploymentApi:
self.execution_api = ExecutionApi() self.execution_api = ExecutionApi()
def post_release(self, target_url: str, tag: str, token: str): def post_release(self, target_url: str, tag: str, token: str):
self.execution_api.execute_secure(f'curl -X "POST" "{target_url}" ' return self.execution_api.execute_secure(f'curl -X "POST" "{target_url}" '
+ '-H "accept: application/json" -H "Content-Type: application/json" ' + '-H "accept: application/json" -H "Content-Type: application/json" '
+ f'-d "{{ "body": "Provides files for release {tag} Attention: The "Source Code"-files below are not up-to-date!", "tag_name": "{tag}"}}" ' # noqa: E501 + f'-d "{{ "body": "Provides files for release {tag} Attention: The "Source Code"-files below are not up-to-date!", "tag_name": "{tag}"}}" ' # noqa: E501
+ f'-H "Authorization: token {token}"', + f'-H "Authorization: token {token}"',
@ -222,7 +222,7 @@ class ArtifactDeploymentApi:
+ f'-d "{{ "body": "Provides files for release {tag} Attention: The "Source Code"-files below are not up-to-date!", "tag_name": "{tag}"}}" ') # noqa: E501 + f'-d "{{ "body": "Provides files for release {tag} Attention: The "Source Code"-files below are not up-to-date!", "tag_name": "{tag}"}}" ') # noqa: E501
def post_asset(self, target_url: str, release_id: str, attachment: str, attachment_type: str, token: str): def post_asset(self, target_url: str, release_id: str, attachment: str, attachment_type: str, token: str):
self.execution_api.execute_secure(f'curl -X "POST" "{target_url}/{release_id}/assets" ' # {target_url}/{release_id}/assets move to Domain return self.execution_api.execute_secure(f'curl -X "POST" "{target_url}/{release_id}/assets" ' # {target_url}/{release_id}/assets move to Domain
+ f'-H "accept: application/json" -H "Authorization: token {token}" ' + f'-H "accept: application/json" -H "Authorization: token {token}" '
+ '-H "Content-Type: multipart/form-data" ' + '-H "Content-Type: multipart/form-data" '
+ f'-F "attachment=@{attachment};type={attachment_type}"', + f'-F "attachment=@{attachment};type={attachment_type}"',