Python logging.warn() Examples
The following are 30
code examples of logging.warn().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
logging
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: symbol_factory.py From dynamic-training-with-apache-mxnet-on-aws with Apache License 2.0 | 6 votes |
def get_symbol(network, data_shape, **kwargs): """Wrapper for get symbol for test Parameters ---------- network : str name for the base network symbol data_shape : int input shape kwargs : dict see symbol_builder.get_symbol for more details """ if network.startswith('legacy'): logging.warn('Using legacy model.') return symbol_builder.import_module(network).get_symbol(**kwargs) config = get_config(network, data_shape, **kwargs).copy() config.update(kwargs) return symbol_builder.get_symbol(**config)
Example #2
Source File: export.py From svviz with MIT License | 6 votes |
def getExportFormat(args): formats = [None, "png", "pdf", "svg"] if args.type == "batch" or args.format is not None: exportFormat = args.format if exportFormat is None: exportFormat = "pdf" else: exportFormat = args.export.partition(".") if len(exportFormat[2]) > 0: exportFormat = exportFormat[2] if exportFormat not in formats: logging.warn("= File suffix {} not recognized; exporting as .svg =".format(exportFormat)) exportFormat = "svg" else: exportFormat = "svg" exportFormat = exportFormat.lower() return exportFormat
Example #3
Source File: app.py From svviz with MIT License | 6 votes |
def saveState(dataHub): import pickle as pickle import gzip pickle.dump(dataHub, gzip.open(dataHub.args.save_state, "wb")) logging.warn("^"*20 + " saving state to pickle and exiting " + "^"*20)
Example #4
Source File: symbol_factory.py From dynamic-training-with-apache-mxnet-on-aws with Apache License 2.0 | 6 votes |
def get_symbol_train(network, data_shape, **kwargs): """Wrapper for get symbol for train Parameters ---------- network : str name for the base network symbol data_shape : int input shape kwargs : dict see symbol_builder.get_symbol_train for more details """ if network.startswith('legacy'): logging.warn('Using legacy model.') return symbol_builder.import_module(network).get_symbol_train(**kwargs) config = get_config(network, data_shape, **kwargs).copy() config.update(kwargs) return symbol_builder.get_symbol_train(**config)
Example #5
Source File: rest_api_plugin.py From airflow-rest-api-plugin with Apache License 2.0 | 6 votes |
def http_token_secure(func): def secure_check(arg): logging.info("Rest_API_Plugin.http_token_secure() called") # Check if the airflow_expected_http_token variable is not none from configurations. This means authentication is enabled. if airflow_expected_http_token: logging.info("Performing Token Authentication") if request.headers.get(airflow_rest_api_plugin_http_token_header_name, None) != airflow_expected_http_token: warning_message = "Token Authentication Failed" logging.warn(warning_message) base_response = REST_API_Response_Util.get_base_response(include_arguments=False) return REST_API_Response_Util.get_403_error_response(base_response=base_response, output=warning_message) return func(arg) return secure_check # Function used to validate the JWT Token
Example #6
Source File: local_scores.py From browserscope with Apache License 2.0 | 6 votes |
def CheckTests(db): cursor = db.cursor() cursor.execute(''' SELECT category, test, count(*) FROM scores WHERE category IS NOT NULL GROUP BY category, test ORDER BY category, test ;''') for category, test_key, num_scores in cursor.fetchall(): test_set = all_test_sets.GetTestSet(category) if not test_set: logging.warn('No test_set for category: %s (num_scores=%s)', category, num_scores) continue test = test_set.GetTest(test_key) if not test: logging.warn('No test: %s, %s (num_scores=%s)', category, test_key, num_scores)
Example #7
Source File: api_fixer.py From gae-secure-scaffold-python with Apache License 2.0 | 6 votes |
def _HttpUrlLoggingWrapper(func): """Decorates func, logging when 'url' params do not start with https://.""" @functools.wraps(func) def _CheckAndLog(*args, **kwargs): try: arg_index = FindArgumentIndex(func, 'url') except ValueError: return func(*args, **kwargs) if arg_index < len(args): arg_value = args[arg_index] elif 'url' in kwargs: arg_value = kwargs['url'] elif 'url' not in kwargs: arg_value = GetDefaultArgument(func, 'url') if arg_value and not arg_value.startswith('https://'): logging.warn('SECURITY : fetching non-HTTPS url %s' % (arg_value)) return func(*args, **kwargs) return _CheckAndLog
Example #8
Source File: transfer.py From Windows-Agent with Apache License 2.0 | 6 votes |
def send_data_to_transfer(data): """ send formated data to transfer via rpc, select transfer randomly and every transfer will retry 3 times if failure Args: data (list of dict): [{}, {}, ...] """ addrs = g.TRANSFER['addrs'] logging.debug(addrs) random.shuffle(addrs) for addr in addrs: call_success = False rpc = get_transfer_rpc_client(addr) for i in range(3): try: res = rpc.call('Transfer.Update', data) except Exception as e: logging.warn("call (%s) Transfer.update failure, times: %s -> msg: %s" % (addr, i, e)) continue call_success = True return res if not call_success: logging.error("send data %s to transfer (%s) failure" % (data, addr))
Example #9
Source File: hbs.py From Windows-Agent with Apache License 2.0 | 6 votes |
def report_status_to_hbs(data): """ send formated data to transfer via rpc Args: data (dict): {} """ addr = g.HEARTBEAT['addr'] rpc = get_hbs_rpc_client(addr) for i in range(3): try: res = rpc.call('Agent.ReportStatus', data) except Exception as e: logging.warn("call (%s) Agent.ReportStatus failure, times: %s -> msg: %s" % (addr, i, e)) continue return res logging.error("report_status_to_hbs %s to hbs (%s) failure" % (data, addr))
Example #10
Source File: get_s3_stats.py From hsds with Apache License 2.0 | 6 votes |
def get_remote_info_json(jfname): try: logging.info('loading example '+jfname) rfo = urllib.urlopen(jfname) di = json.loads(rfo.read()) nat, glbs = 0, 0 for k,v in di.items(): if k != 'dimensions' or k != 'variables': glbs +=1 for k,v in di['variables'].items(): for a in v: nat += 1 dims = [ l for k, v in di['dimensions'].items() for d, l in v.items() if d == 'length' ] return { 'num global attr' : glbs, 'num vars' : len(di['variables'].keys()), 'num dims' : \ len(di['dimensions'].keys()), 'ave attrs per var' : nat / len(di['variables'].keys()), \ 'dims sizes' : dims } except Exception, e: logging.warn("WARN get_remote_info_json on %s : %s, update S3 bucket" % (jfname, str(e))) return {} #---------------------------------------------------------------------------------
Example #11
Source File: models.py From dataiku-contrib with Apache License 2.0 | 6 votes |
def make_extra_conf(self, extra_conf_template, add_overwrite_keys=None): for k in extra_conf_template: value = self._generate_value_from_template_key(k, extra_conf_template[k]) if value: extra_conf_template[k] = value else: logging.warn('Value for key %s is None removing from config' % k) extra_conf_template.pop(k) # Useful to build storage config - keep it after first template transformation if add_overwrite_keys: for k in add_overwrite_keys: new_value = add_overwrite_keys[k] if extra_conf_template.get(k): logging.warn('Overriding key:{} value: {} with new_value {}'.format(k,extra_conf_template[k], new_value)) else: logging.info('Adding new key:{} with value: {}'.format(k, new_value)) extra_conf_template[k] = new_value return self._make_extra_conf_as_kv_list(extra_conf_template)
Example #12
Source File: bootstrap.py From loaner with Apache License 2.0 | 6 votes |
def bootstrap_chrome_ous(**kwargs): """Bootstraps Chrome device OUs. Args: **kwargs: keyword args including a user_email with which to run the Directory API client methods (required for BigQuery streaming). """ logging.info('Requesting delegated admin for bootstrap') client = directory.DirectoryApiClient(user_email=kwargs['user_email']) for org_unit_name, org_unit_path in constants.ORG_UNIT_DICT.iteritems(): logging.info( 'Creating org unit %s at path %s ...', org_unit_name, org_unit_path) if client.get_org_unit(org_unit_path): logging.warn(_ORG_UNIT_EXISTS_MSG, org_unit_name) else: client.insert_org_unit(org_unit_path)
Example #13
Source File: speech_sentences.py From zamia-speech with GNU Lesser General Public License v3.0 | 6 votes |
def proc_corpus_with_one_sentence_perline(corpus_path, tokenize, lang): logging.info("adding sentences from %s..." % corpus_path) num_sentences = 0 with codecs.open(corpus_path, 'r', 'utf8') as inf: for line in inf: sentence = u' '.join(tokenize(line, lang=lang)) if not sentence: logging.warn('%s: skipping null sentence.' % corpus_path) continue yield u'%s' % sentence num_sentences += 1 if num_sentences % SENTENCES_STATS == 0: logging.info('%s: %8d sentences.' % (corpus_path, num_sentences)) if DEBUG_LIMIT and num_sentences >= DEBUG_LIMIT: logging.warn('%s: debug limit reached, stopping.' % corpus_path) break
Example #14
Source File: speech_sentences.py From zamia-speech with GNU Lesser General Public License v3.0 | 6 votes |
def proc_cornell_movie_dialogs(corpus_path, tokenize): num_sentences = 0 with codecs.open('%s/movie_lines.txt' % corpus_path, 'r', 'latin1') as inf: for line in inf: parts = line.split('+++$+++') if not len(parts) == 5: logging.warn('movie dialogs: skipping line %s' % line) continue sentence = u' '.join(tokenize(parts[4], lang='en')) if not sentence: logging.warn('movie dialogs: skipping null sentence %s' % line) continue yield u'%s' % sentence num_sentences += 1 if num_sentences % SENTENCES_STATS == 0: logging.info('movie dialogs: %8d sentences.' % num_sentences) if DEBUG_LIMIT and num_sentences >= DEBUG_LIMIT: logging.warn('movie dialogs: debug limit reached, stopping.') break
Example #15
Source File: local_scores.py From browserscope with Apache License 2.0 | 5 votes |
def Add(self, score): if score < self.MIN_SCORE: score = self.MIN_SCORE logging.warn('CountRanker(key_name=%s) value out of range (%s to %s): %s', self.key().name(), self.MIN_SCORE, self.MAX_SCORE, score) elif score > self.MAX_SCORE: score = self.MAX_SCORE logging.warn('CountRanker(key_name=%s) value out of range (%s to %s): %s', self.key().name(), self.MIN_SCORE, self.MAX_SCORE, score) slots_needed = score - len(self.counts) + 1 if slots_needed > 0: self.counts.extend([0] * slots_needed) self.counts[score] += 1
Example #16
Source File: result.py From browserscope with Apache License 2.0 | 5 votes |
def GetOrCreateRankers(self): parent = self.parent() test_set = all_test_sets.GetTestSet(parent.category) test = test_set.GetTest(self.test) #logging.info('GetOrCreateRankers %s' % test.get_memcache_keyname()) if test: params_str = parent.params_str or None return test.GetOrCreateRankers(parent.GetBrowsers(), params_str) else: logging.warn('Test key not found in test_set: %s', self.test) return []
Example #17
Source File: gaeunit.py From browserscope with Apache License 2.0 | 5 votes |
def _log_error(s): logging.warn(s) return s ################################################ # Browser HTML, CSS, and Javascript ################################################ # This string uses Python string formatting, so be sure to escape percents as %%.
Example #18
Source File: result_ranker.py From browserscope with Apache License 2.0 | 5 votes |
def Add(self, score): if score < self.MIN_SCORE: score = self.MIN_SCORE logging.warn('CountRanker(key_name=%s) value out of range (%s to %s): %s', self.key().name(), self.MIN_SCORE, self.MAX_SCORE, score) elif score > self.MAX_SCORE: score = self.MAX_SCORE logging.warn('CountRanker(key_name=%s) value out of range (%s to %s): %s', self.key().name(), self.MIN_SCORE, self.MAX_SCORE, score) slots_needed = score - len(self.counts) + 1 if slots_needed > 0: self.counts.extend([0] * slots_needed) self.counts[score] += 1 RankerCacher.CachePut(self)
Example #19
Source File: zwift_offline.py From zwift-offline with GNU General Public License v3.0 | 5 votes |
def garmin_upload(player_id, activity): try: from garmin_uploader.workflow import Workflow except ImportError: logger.warn("garmin_uploader is not installed. Skipping Garmin upload attempt.") return profile_dir = '%s/%s' % (STORAGE_DIR, player_id) try: with open('%s/garmin_credentials.txt' % profile_dir, 'r') as f: username = f.readline().rstrip('\r\n') password = f.readline().rstrip('\r\n') except: logger.warn("Failed to read %s/garmin_credentials.txt. Skipping Garmin upload attempt." % profile_dir) return try: with open('%s/last_activity.fit' % profile_dir, 'wb') as f: f.write(activity.fit) except: logger.warn("Failed to save fit file. Skipping Garmin upload attempt.") return try: w = Workflow(['%s/last_activity.fit' % profile_dir], activity_name=activity.name, username=username, password=password) w.run() except: logger.warn("Garmin upload failed. No internet?") # With 64 bit ids Zwift can pass negative numbers due to overflow, which the flask int # converter does not handle so it's a string argument
Example #20
Source File: zwift_offline.py From zwift-offline with GNU General Public License v3.0 | 5 votes |
def strava_upload(player_id, activity): try: from stravalib.client import Client except ImportError: logger.warn("stravalib is not installed. Skipping Strava upload attempt.") return profile_dir = '%s/%s' % (STORAGE_DIR, player_id) strava = Client() try: with open('%s/strava_token.txt' % profile_dir, 'r') as f: client_id = f.readline().rstrip('\r\n') client_secret = f.readline().rstrip('\r\n') strava.access_token = f.readline().rstrip('\r\n') refresh_token = f.readline().rstrip('\r\n') expires_at = f.readline().rstrip('\r\n') except: logger.warn("Failed to read %s/strava_token.txt. Skipping Strava upload attempt." % profile_dir) return try: if time.time() > int(expires_at): refresh_response = strava.refresh_access_token(client_id=client_id, client_secret=client_secret, refresh_token=refresh_token) with open('%s/strava_token.txt' % profile_dir, 'w') as f: f.write(client_id + '\n') f.write(client_secret + '\n') f.write(refresh_response['access_token'] + '\n') f.write(refresh_response['refresh_token'] + '\n') f.write(str(refresh_response['expires_at']) + '\n') except: logger.warn("Failed to refresh token. Skipping Strava upload attempt.") return try: # See if there's internet to upload to Strava strava.upload_activity(BytesIO(activity.fit), data_type='fit', name=activity.name) # XXX: assume the upload succeeds on strava's end. not checking on it. except: logger.warn("Strava upload failed. No internet?")
Example #21
Source File: zwift_offline.py From zwift-offline with GNU General Public License v3.0 | 5 votes |
def api_profiles_me(): profile_dir = '%s/%s' % (STORAGE_DIR, selected_profile) try: if not os.path.isdir(profile_dir): os.makedirs(profile_dir) except IOError as e: logger.error("failed to create profile dir (%s): %s", profile_dir, str(e)) sys.exit(1) profile = profile_pb2.Profile() profile_file = '%s/profile.bin' % profile_dir if not os.path.isfile(profile_file): profile.id = selected_profile profile.is_connected_to_strava = True profile.email = 'user@email.com' # At least Win Zwift client no longer asks for a name profile.first_name = "zoffline" profile.last_name = "user" return profile.SerializeToString(), 200 with open(profile_file, 'rb') as fd: profile.ParseFromString(fd.read()) # ensure profile.id = directory (in case directory is renamed) if profile.id != selected_profile: logger.warn('player_id is different from profile directory, updating database...') cur = g.db.cursor() cur.execute('UPDATE activity SET player_id = ? WHERE player_id = ?', (str(selected_profile), str(profile.id))) cur.execute('UPDATE goal SET player_id = ? WHERE player_id = ?', (str(selected_profile), str(profile.id))) cur.execute('UPDATE segment_result SET player_id = ? WHERE player_id = ?', (str(selected_profile), str(profile.id))) g.db.commit() profile.id = selected_profile if not profile.email: profile.email = 'user@email.com' # clear f60 to remove free trial limit if profile.f60: logger.warn('Profile contains bytes related to subscription/billing, removing...') del profile.f60[:] return profile.SerializeToString(), 200
Example #22
Source File: gen_protorpc.py From browserscope with Apache License 2.0 | 5 votes |
def generate_file_descriptor(dest_dir, file_descriptor, force_overwrite): """Generate a single file descriptor to destination directory. Will generate a single Python file from a file descriptor under dest_dir. The sub-directory where the file is generated is determined by the package name of descriptor. Descriptors without package names will not be generated. Descriptors that are part of the ProtoRPC distribution will not be generated. Args: dest_dir: Directory under which to generate files. file_descriptor: FileDescriptor instance to generate source code from. force_overwrite: If True, existing files will be overwritten. """ package = file_descriptor.package if not package: # TODO(rafek): Option to cause an error on this condition. logging.warn('Will not generate descriptor without package name') return if package in EXCLUDED_PACKAGES: logging.warn('Will not generate main ProtoRPC class %s' % package) return package_path = package.split('.') directory = package_path[:-1] package_file_name = package_path[-1] directory_name = os.path.join(dest_dir, *directory) output_file_name = os.path.join(directory_name, '%s.py' % (package_file_name,)) try: os.makedirs(directory_name) except OSError, err: if err.errno != errno.EEXIST: raise
Example #23
Source File: bedtrack.py From genomeview with MIT License | 5 votes |
def fetch_from_plainbed(path, chrom, start, end): found_chrom = False for line in open(path): fields = line.strip().split() if fields[0] != chrom: continue found_chrom = True cur_start, cur_end = fields[1:3] if int(cur_end) < start or int(cur_start) > end: continue yield tx_from_bedfields(fields) if not found_chrom: warning = "Didn't find chromosome {}; make sure it's formatted correctly (eg 'chr1' vs '1')".format(chrom) logging.warn(warning)
Example #24
Source File: dev_appserver_apiserver.py From browserscope with Apache License 2.0 | 5 votes |
def _GetRpcOrRest(self, api_format): """Sends back HTTP response with API directory. Args: api_format: Either 'rest' or 'rpc'. Sends CGI response containing the discovery doc for the api/version. Returns: None. """ api = self._params['api'] version = self._params['version'] lookup_key = (api, version) api_config = self._config_manager.configs.get(lookup_key) if not api_config: logging.warn('No discovery doc for version %s of api %s', version, api) SendCGINotFoundResponse(self._outfile) return doc = self._discovery_proxy.GenerateDiscoveryDoc(api_config, api_format) if not doc: error_msg = ('Failed to convert .api to discovery doc for ' 'version %s of api %s') % (version, api) logging.error('%s', error_msg) SendCGIErrorResponse(error_msg, self._outfile) return self._SendSuccessResponse(doc)
Example #25
Source File: GruntfileInfoExtractor.py From coala-quickstart with GNU Affero General Public License v3.0 | 5 votes |
def get_task_config(self, parsed_config): """ From the parsed configuration object for a task, extract and return the config settings in the form of a python dict. :param parsed_config: A portion of `PyJsParser().parse` instance of "Gruntfile.js" that contains configuration of a task defined appearing in "Gruntfile.js" in the form of `grunt.initConfig({"task": "config"})` :returns: A python dictionary of configurations in the form of key-value pairs. """ result = {} for prop in parsed_config['properties']: prop_value = None if prop['value']['type'] == 'Identifier': prop_value = prop['value']['name'] elif prop['value']['type'] == 'Literal': prop_value = prop['value']['value'] elif prop['value']['type'] == 'ObjectExpression': prop_value = self.get_task_config(prop['value']) elif prop['value']['type'] == 'ArrayExpression': prop_value = self.extract_literals_from_expression(prop) else: logging.warn( 'quickstart was not able to parse the value ' 'of the config {}'.format( prop['key']['name'])) result[prop['key']['name']] = prop_value return result
Example #26
Source File: speech_sentences.py From zamia-speech with GNU Lesser General Public License v3.0 | 5 votes |
def proc_yahoo_answers(corpus_path, tokenize): num_sentences = 0 for infn in os.listdir('%s/text' % corpus_path): logging.debug('yahoo answers: reading file %s' % infn) with codecs.open('%s/text/%s' % (corpus_path, infn), 'r', 'latin1') as inf: for line in inf: sentence = u' '.join(tokenize(line, lang='en')) if not sentence: continue yield u'%s' % sentence num_sentences += 1 if num_sentences % SENTENCES_STATS == 0: logging.info( 'yahoo answers: %8d sentences.' % num_sentences) if DEBUG_LIMIT and num_sentences >= DEBUG_LIMIT: logging.warn( 'yahoo answers: debug limit reached, stopping.') break if DEBUG_LIMIT and num_sentences >= DEBUG_LIMIT: logging.warn('yahoo answers: debug limit reached, stopping.') break
Example #27
Source File: remap.py From svviz with MIT License | 5 votes |
def do_realign(dataHub, sample): processes = dataHub.args.processes if processes is None or processes == 0: # we don't really gain from using virtual cores, so try to figure out how many physical # cores we have processes = misc.cpu_count_physical() variant = dataHub.variant reads = sample.reads name = "{}:{{}}".format(sample.name[:15]) t0 = time.time() refalignments, badReadsRef = do1remap(variant.chromParts("ref"), reads, processes, jobName=name.format("ref"), tryExact=dataHub.args.fast) altalignments, badReadsAlt = do1remap(variant.chromParts("alt"), reads, processes, jobName=name.format("alt"), tryExact=dataHub.args.fast) t1 = time.time() logging.debug(" Time to realign: {:.1f}s".format(t1-t0)) badReads = badReadsRef.union(badReadsAlt) if len(badReads) > 0: logging.warn(" Alignment failed with {} reads (this is a known issue)".format(badReads)) for badRead in badReads: refalignments.pop(badRead, None) altalignments.pop(badRead, None) assert set(refalignments.keys()) == set(altalignments.keys()), \ set(refalignments.keys()) ^ set(altalignments.keys()) alnCollections = [] for key in refalignments: alnCollection = AlignmentSetCollection(key) alnCollection.addSet(refalignments[key], "ref") alnCollection.addSet(altalignments[key], "alt") alnCollections.append(alnCollection) return alnCollections
Example #28
Source File: dev_appserver_apiserver.py From browserscope with Apache License 2.0 | 5 votes |
def LookupRestMethod(self, path, http_method): """Look up the rest method at call time. The method is looked up in self._rest_methods, the list it is saved in for SaveRestMethod. Args: path: Path from the URL of the request. http_method: HTTP method of the request. Returns: Tuple of (<method name>, <method>, <params>) Where: <method name> is the string name of the method that was matched. <method> is the descriptor as specified in the API configuration. -and- <params> is a dict of path parameters matched in the rest request. """ for compiled_path_pattern, unused_path, methods in self._rest_methods: match = compiled_path_pattern.match(path) if match: params = self._GetPathParams(match) version = match.group(2) method_key = (http_method.lower(), version) method_name, method = methods.get(method_key, (None, None)) if method is not None: break else: logging.warn('No endpoint found for path: %s', path) method_name = None method = None params = None return method_name, method, params
Example #29
Source File: speech_sentences.py From zamia-speech with GNU Lesser General Public License v3.0 | 5 votes |
def proc_web_questions(corpus_path, tokenize): num_sentences = 0 for infn in ['webquestions.examples.test.json', 'webquestions.examples.train.json']: with open('%s/%s' % (corpus_path, infn), 'r') as inf: data = json.loads(inf.read()) for a in data: sentence = u' '.join(tokenize(a['utterance'], lang='en')) if not sentence: logging.warn( 'web questions: skipping null sentence') continue yield u'%s' % sentence num_sentences += 1 if num_sentences % SENTENCES_STATS == 0: logging.info( 'web questions: %8d sentences.' % num_sentences) if DEBUG_LIMIT and num_sentences >= DEBUG_LIMIT: logging.warn( 'web questions: debug limit reached, stopping.') break
Example #30
Source File: discovery_service.py From browserscope with Apache License 2.0 | 5 votes |
def _get_rpc_or_rest(self, api_format, request, start_response): """Sends back HTTP response with API directory. This calls start_response and returns the response body. It will return the discovery doc for the requested api/version. Args: api_format: A string containing either 'rest' or 'rpc'. request: An ApiRequest, the transformed request sent to the Discovery SPI. start_response: A function with semantics defined in PEP-333. Returns: A string, the response body. """ api = request.body_json['api'] version = request.body_json['version'] lookup_key = (api, version) api_config = self._config_manager.configs.get(lookup_key) if not api_config: logging.warn('No discovery doc for version %s of api %s', version, api) return util.send_wsgi_not_found_response(start_response) doc = self._discovery_proxy.generate_discovery_doc(api_config, api_format) if not doc: error_msg = ('Failed to convert .api to discovery doc for ' 'version %s of api %s') % (version, api) logging.error('%s', error_msg) return util.send_wsgi_error_response(error_msg, start_response) return self._send_success_response(doc, start_response)