Skip to content

Commit 4ffc7d6

Browse files
authored
Fix for params already being a dict (#21)
* Fix for params already being a dict * Payload needed to be str not dict * Fixed check for the right status code
1 parent 7f100fd commit 4ffc7d6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

socketdev/repos/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import logging
23
from typing import List, Optional
34
from dataclasses import dataclass, asdict
@@ -131,9 +132,10 @@ def post(self, org_slug: str, **kwargs) -> dict:
131132
return {}
132133

133134
path = "orgs/" + org_slug + "/repos"
134-
response = self.api.do_request(path=path, method="POST", payload=params.__dict__)
135+
payload = json.dumps(params)
136+
response = self.api.do_request(path=path, method="POST", payload=payload)
135137

136-
if response.status_code == 200:
138+
if response.status_code == 201:
137139
result = response.json()
138140
return result
139141

@@ -150,7 +152,8 @@ def update(self, org_slug: str, repo_name: str, **kwargs) -> dict:
150152
return {}
151153

152154
path = f"orgs/{org_slug}/repos/{repo_name}"
153-
response = self.api.do_request(path=path, method="POST", payload=params.__dict__)
155+
payload = json.dumps(params)
156+
response = self.api.do_request(path=path, method="POST", payload=payload)
154157

155158
if response.status_code == 200:
156159
result = response.json()

socketdev/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.0.5"
1+
__version__ = "2.0.6"

0 commit comments

Comments
 (0)