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


Python MbXmlParser.parse方法代码示例

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


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

示例1: getUserRating

# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import parse [as 别名]
	def getUserRating(self, entityUri):
		"""Return the rating a user has applied to an entity.

		The given parameter has to be a fully qualified MusicBrainz
		ID, as returned by other library functions.
		
		Note that this method only works if a valid user name and
		password have been set. Only the rating the authenticated user
		applied to the entity will be returned. If username and/or
		password are incorrect, an AuthenticationError is raised.
		
		This method will return a L{Rating <musicbrainz2.model.Rating>}
		object.
		
		@param entityUri: a string containing an absolute MB ID
		
		@raise ValueError: invalid entityUri
  		@raise ConnectionError: couldn't connect to server
		@raise RequestError: invalid ID or entity
		@raise AuthenticationError: invalid user name and/or password
		"""
		entity = mbutils.extractEntityType(entityUri)
		uuid = mbutils.extractUuid(entityUri, entity)
		params = { 'entity': entity, 'id': uuid }
		
		stream = self._ws.get('rating', '', filter=params)
		try:
			parser = MbXmlParser()
			result = parser.parse(stream)
		except ParseError, e:
			raise ResponseError(str(e), e)
开发者ID:apotapov,项目名称:musicproject,代码行数:33,代码来源:webservice.py

示例2: _getFromWebService

# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import parse [as 别名]
	def _getFromWebService(self, entity, id_, include=None, filter=None):
		if filter is None:
			filterParams = [ ]
		else:
			filterParams = filter.createParameters()

		if include is None:
			includeParams = [ ]
		else:
			includeParams = include.createIncludeTags()

		stream = self._ws.get(entity, id_, includeParams, filterParams)
		try:
			parser = MbXmlParser()
			return parser.parse(stream)
		except ParseError, e:
			raise ResponseError(str(e), e)
开发者ID:apotapov,项目名称:musicproject,代码行数:19,代码来源:webservice.py

示例3: getUserCollection

# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import parse [as 别名]
	def getUserCollection(self, offset=0, maxitems=100):
		"""Get the releases that are in a user's collection
		
		A maximum of 100 items will be returned for any one call
		to this method. To fetch more than 100 items, use the offset
		parameter.

		@param offset: the offset to start fetching results from
		@param maxitems: the upper limit on items to return

		@return: a list of L{musicbrainz2.wsxml.ReleaseResult} objects

		@raise ConnectionError: couldn't connect to server
		@raise AuthenticationError: invalid user name and/or password
		"""
		params = { 'offset': offset, 'maxitems': maxitems }
		
		stream = self._ws.get('collection', '', filter=params)
		try:
			parser = MbXmlParser()
			result = parser.parse(stream)
		except ParseError, e:
			raise ResponseError(str(e), e)
开发者ID:mineo,项目名称:python-musicbrainz2,代码行数:25,代码来源:webservice.py


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