def getURL(self, url, headers): logger.debug("file nws get url: " + url) response = get_mockdata_url("nws", self._conf, url, headers) if response.status == 404: logger.debug("status 404") response.data = '{"error": {"code": "7000","message": "No record matched"}}' return response
def getURL(self, url, headers): if url not in File._cache_db: response = get_mockdata_url("gws", self._conf, url, headers) else: response = MockHTTP() response.data = File._cache_db[url] response.status = 200 return response
def postURL(self, url, headers, body): logger.debug('file nws post url: ' + url) response = get_mockdata_url("nws", self._conf, url, headers) if response.status == 404: logger.debug('status 404') response.data = '{"error": {"code": "7000","message": "No record matched"}}' return response
def getURL(self, url, headers): logger.debug('file nws get url: ' + url) if url not in File._cache_db: response = get_mockdata_url("nws", self._conf, url, headers) else: logger.debug('using cache') response = MockHTTP() response.data = File._cache_db[url] response.status = 200 if response.status == 404: logger.debug('status 404') response.data = '{"error": {"code": "7000","message": "No record matched"}}' return response
def putURL(self, url, headers, body): logger.debug('file irws put url: ' + url) print('file irws put url: ' + url) response = get_mockdata_url("irws", self._conf, url, headers) if response.status == 404: # try set in cache File._cache_db[url] = body print('not found for put - cache') logger.debug('not found for put - cache') response.data = '{"cached": {"code": "0000","message": "put cached in mock data"}}' response.status = 200 return response
def getURL(self, url, headers): return get_mockdata_url("gws", self._conf, url, headers)