Skip to content

Commit 937b5bf

Browse files
authored
Merge pull request #388 from aperture-data/release-0.4.20
Release 0.4.20
2 parents ad576ea + 3084d9a commit 937b5bf

File tree

3 files changed

+23
-17
lines changed

3 files changed

+23
-17
lines changed

aperturedb/ConnectorRest.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,25 @@ def _query(self, query, blob_array = [], try_resume=True):
119119
response.status_code = 0
120120
while tries < self.config.retry_max_attempts:
121121
tries += 1
122-
response = self.http_session.post(self.url,
123-
headers = headers,
124-
files = files,
125-
verify = self.use_ssl)
126-
if response.status_code == 200:
127-
# Parse response:
128-
json_response = json.loads(response.text)
129-
import base64
130-
response_blob_array = [base64.b64decode(
131-
b) for b in json_response['blobs']]
132-
self.last_response = json_response["json"]
133-
break
134-
logger.error(
135-
f"Response not OK = {response.status_code} {response.text[:1000]}\n\
136-
attempt [{tries}/3] .. PID = {os.getpid()}")
122+
try:
123+
response = self.http_session.post(self.url,
124+
headers = headers,
125+
files = files,
126+
verify = self.use_ssl)
127+
if response.status_code == 200:
128+
# Parse response:
129+
json_response = json.loads(response.text)
130+
import base64
131+
response_blob_array = [base64.b64decode(
132+
b) for b in json_response['blobs']]
133+
self.last_response = json_response["json"]
134+
break
135+
logger.error(
136+
f"Response not OK = {response.status_code} {response.text[:1000]}\n\
137+
attempt [{tries}/3] .. PID = {os.getpid()}")
138+
except Exception as e:
139+
logger.error(f"Exception during http.post = {e}\n\
140+
attempt [{tries}/3] .. PID = {os.getpid()}")
137141

138142
time.sleep(self.config.retry_interval_seconds)
139143

aperturedb/Entities.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ def get_blob(self, entity) -> Any:
250250
"count": True
251251
}
252252
}
253-
if self.spec.operations:
253+
# An entities object is created with the response of the query
254+
# or a spec. Check if the spec is not None, and if it has operations.
255+
if self.spec and self.spec.operations:
254256
cmd_params["operations"] = self.spec.operations.operations_arr
255257
query = [
256258
QueryBuilder().find_command(self.db_object, params=cmd_params)

aperturedb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
logger = logging.getLogger(__name__)
99

10-
__version__ = "0.4.19"
10+
__version__ = "0.4.20"
1111

1212
# set log level
1313
logger.setLevel(logging.DEBUG)

0 commit comments

Comments
 (0)