MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / get_answer_data

Method get_answer_data

dwave/cloud/api/resources.py:292–308  ·  view source on GitHub ↗

Retrieve binary-ref answer data.

(self,
                        answer: models.UnstructuredProblemAnswerBinaryRef,
                        output: Optional[io.IOBase] = None,
                        )

Source from the content-addressed store, hash-verified

290
291 @accepts(media_type='application/octet-stream')
292 def get_answer_data(self,
293 answer: models.UnstructuredProblemAnswerBinaryRef,
294 output: Optional[io.IOBase] = None,
295 ) -> io.IOBase:
296 """Retrieve binary-ref answer data."""
297 if answer.auth_method != constants.BinaryRefAuthMethod.SAPI_TOKEN:
298 raise ValueError(f"Authentication method {answer.auth_method!r} not supported.")
299
300 if output is None:
301 output = io.BytesIO()
302
303 for chunk in self.session.get(answer.url, stream=True).iter_content(chunk_size=8192):
304 output.write(chunk)
305
306 output.seek(0)
307
308 return output
309
310 @accepts(media_type='application/vnd.dwave.sapi.problem-message+json',
311 version='>=2.1,<4', ask_version='3.0.0')

Callers 1

Calls 3

writeMethod · 0.80
seekMethod · 0.80
getMethod · 0.45

Tested by 1