当前位置: 首页>>代码示例>>Python>>正文


Python Config.getint方法代码示例

本文整理汇总了Python中util.config.Config.getint方法的典型用法代码示例。如果您正苦于以下问题:Python Config.getint方法的具体用法?Python Config.getint怎么用?Python Config.getint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util.config.Config的用法示例。


在下文中一共展示了Config.getint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _on_api_response

# 需要导入模块: from util.config import Config [as 别名]
# 或者: from util.config.Config import getint [as 别名]
	def _on_api_response(self, response):
		if response is None:
			logging.error("API request for %s failed." % self.gplus_user_id)
			self.write("Unable to fetch content for this Google+ ID; it may not be authenticated. See http://%s for more information." % self.request.host)
			self.set_status(401)
			return self.finish()
		if response.error:
			if response.code == 403:
				logging.error("API Request 403: %r" % (json.loads(response.body)))
				self.set_status(503)
				self.write("Unable to fulfill request at this time - Google+ API rate limit exceeded.")
				return self.finish()
			else:
				logging.error("AsyncHTTPRequest error: %r, %r" % (response.error, response))
				return self.send_error(500)
		else:
			data = json.loads(response.body)

			headers = {'Content-Type': 'application/atom+xml'}
			params = {
				'userid': self.gplus_page_id or self.gplus_user_id,
				'baseurl': 'http://%s' % self.request.host,
				'requesturi': 'http://%s%s' % (self.request.host, self.request.uri.split('?', 1)[0]),
			}

			if 'items' not in data or not data['items']:
				params['lastupdate'] = dateutils.to_atom_format(datetime.datetime.today())
				return self._respond(headers, empty_feed_template.format(**params))

			posts = data['items']

			lastupdate = max(dateutils.from_iso_format(p['updated']) for p in posts)
			params['author'] = xhtml_escape(posts[0]['actor']['displayName'])
			params['lastupdate'] = dateutils.to_atom_format(lastupdate)

			headers['Last-Modified'] = dateutils.to_http_format(lastupdate)

			params['entrycontent'] = u''.join(entry_template.format(**get_post_params(p)) for p in posts)

			body = feed_template.format(**params)

			Cache.set(self.cache_key, {'headers': headers, 'body': body}, time=Config.getint('cache', 'stream-expire'))
			return self._respond(headers, body)
开发者ID:astore,项目名称:pluss,代码行数:45,代码来源:atom.py

示例2: on_fetch_person_complete

# 需要导入模块: from util.config import Config [as 别名]
# 或者: from util.config.Config import getint [as 别名]
	def on_fetch_person_complete(cls, response, callback):
		"""Callback for the people/me API call in fetch_person_by_token."""
		person = json.loads(response.body)
		Cache.set(cls.profile_cache_key_template % person['id'], person, time=Config.getint('cache', 'profile-expire'))
		return IOLoop.instance().add_callback(lambda: callback(person))
开发者ID:astore,项目名称:pluss,代码行数:7,代码来源:oauth.py

示例3: _expand_path

# 需要导入模块: from util.config import Config [as 别名]
# 或者: from util.config.Config import getint [as 别名]
application = tornado.web.Application(
	route.get_routes(),
	gzip = True,
	static_path = 'static',
	template_path = 'templates',
)	
	
if __name__ == '__main__':

	logging.basicConfig(
		level=getattr(logging, Config.get('system', 'log-level')),
		format="%(asctime)-15s [%(process)d|%(threadName)s] %(message)s",
	)

	pid_path = _expand_path(Config.get('system', 'pid-path'))

	pid.check(pid_path)
	time.sleep(1) # Give a little time for ports to be recognized as unbound

	pid.write(pid_path)
	try:
		db.init(_expand_path(Config.get('database', 'path')))

		http_server = HTTPServer(application, xheaders=True)
		http_server.bind(Config.getint('network', 'port'))
		http_server.start()
		IOLoop.instance().start()
	finally:
		pid.remove(pid_path)
开发者ID:astore,项目名称:pluss,代码行数:31,代码来源:pluss.py


注:本文中的util.config.Config.getint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。