Skip to content

Commit ff86a2b

Browse files
committed
Enable use of ID type STRING
1 parent baa981c commit ff86a2b

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

frost_sta_client/dao/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def create(self, entity):
110110
e.response.status_code,
111111
error_message))
112112
raise e
113-
entity.id = int(frost_sta_client.utils.extract_value(response.headers['location']))
113+
entity.id = frost_sta_client.utils.extract_value(response.headers['location'])
114114
entity.service = self.service
115115
logging.debug('Received response: ' + str(response.status_code))
116116

frost_sta_client/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@
2323

2424

2525
def extract_value(location):
26-
return location[location.find('(')+1: location.find(')')]
27-
26+
try:
27+
value = int(location[location.find('(')+1: location.find(')')])
28+
except ValueError:
29+
value = str(location[location.find('(')+2: location.find(')')-1])
30+
return value
2831

2932
def transform_entity_to_json_dict(entity):
3033
json_str = jsonpickle.encode(entity, unpicklable=False)

0 commit comments

Comments
 (0)