MCPcopy Create free account
hub / github.com/ActiveState/code / request

Method request

recipes/Python/577654_DDE_Client/recipe-577654.py:179–200  ·  view source on GitHub ↗

Request data from DDE service.

(self, item, timeout=5000)

Source from the content-addressed store, hash-verified

177 DDE.FreeDataHandle(hDdeData)
178
179 def request(self, item, timeout=5000):
180 """Request data from DDE service."""
181 from ctypes import byref
182
183 hszItem = DDE.CreateStringHandle(self._idInst, item, 1200)
184 hDdeData = DDE.ClientTransaction(LPBYTE(), 0, self._hConv, hszItem, CF_TEXT, XTYP_REQUEST, timeout, LPDWORD())
185 DDE.FreeStringHandle(self._idInst, hszItem)
186 if not hDdeData:
187 raise DDEError("Unable to request item", self._idInst)
188
189 if timeout != TIMEOUT_ASYNC:
190 pdwSize = DWORD(0)
191 pData = DDE.AccessData(hDdeData, byref(pdwSize))
192 if not pData:
193 DDE.FreeDataHandle(hDdeData)
194 raise DDEError("Unable to access data", self._idInst)
195 # TODO: use pdwSize
196 DDE.UnaccessData(hDdeData)
197 else:
198 pData = None
199 DDE.FreeDataHandle(hDdeData)
200 return pData
201
202 def callback(self, value, item=None):
203 """Calback function for advice."""

Callers 8

recipe-577548.pyFile · 0.45
httpExistsFunction · 0.45
recipe-578846.pyFile · 0.45
post_cookbookFunction · 0.45
stop_serverFunction · 0.45
recipe-301740.pyFile · 0.45
pipelineFunction · 0.45
__requestMethod · 0.45

Calls 1

DDEErrorClass · 0.85

Tested by

no test coverage detected