onedrive/api_v5.py
def resolve_path(self, path, root_id='me/skydrive', objects=False, listdir_limit=500):
		'''Return id (or metadata) of an object, specified by chain
				(iterable or fs-style path string) of "name" attributes
				of its ancestors, or raises DoesNotExists error.

			Requires many calls to resolve each name in path, so use with care.
				root_id parameter allows to specify path relative to some folder_id
				(default: me/skydrive).'''
		if path:
			if isinstance(path, types.StringTypes):
				if not path.startswith('me/skydrive'):
					# Split path by both kinds of slashes
					path = filter(None, it.chain.from_iterable(p.split('\\') for p in path.split('/')))
				else: root_id, path = path, None
			if path:
				try:
					for i, name in enumerate(path):
						offset = None
						while True:
							obj_list = self.listdir(root_id, offset=offset, limit=listdir_limit)
							try: root_id = dict(it.imap(op.itemgetter('name', 'id'), obj_list))[name]
							except KeyError:
								if len(obj_list) < listdir_limit: raise # assuming that it's the last page
								offset = (offset or 0) + listdir_limit
							else: break
				except (KeyError, ProtocolError) as err:
					if isinstance(err, ProtocolError) and err.code != 404: raise
					raise DoesNotExists(root_id, path[i:])
		return root_id if not objects else self.info(root_id)
def resolve_path(self, path, root_id='me/skydrive', objects=False, listdir_limit=500):
		'''Return id (or metadata) of an object, specified by chain
				(iterable or fs-style path string) of "name" attributes
				of its ancestors, or raises DoesNotExists error.

			Requires many calls to resolve each name in path, so use with care.
				root_id parameter allows to specify path relative to some folder_id
				(default: me/skydrive).'''
		if path:
			if isinstance(path, types.StringTypes):
				if not path.startswith('me/skydrive'):
					# Split path by both kinds of slashes
					path = filter(None, it.chain.from_iterable(p.split('\\') for p in path.split('/')))
				else: root_id, path = path, None
			if path:
				try:
					for i, name in enumerate(path):
						offset = None
						while True:
							obj_list = self.listdir(root_id, offset=offset, limit=listdir_limit)
							try: root_id = dict(it.imap(op.itemgetter('name', 'id'), obj_list))[name]
							except KeyError:
								if len(obj_list) < listdir_limit: raise # assuming that it's the last page
								offset = (offset or 0) + listdir_limit
							else: break
				except (KeyError, ProtocolError) as err:
					if isinstance(err, ProtocolError) and err.code != 404: raise
					raise DoesNotExists(root_id, path[i:])
		return root_id if not objects else self.info(root_id)
Return id (or metadata) of an object, specified by chain
				(iterable or fs-style path string) of "name" attributes
				of its ancestors, or raises DoesNotExists error.

			Requires many calls to resolve each name in path, so use with care.
				root_id parameter allows to specify path relative to some folder_id
				(default: me/skydrive).