|
58 | 58 | _convert_xml_to_containers, |
59 | 59 | _parse_blob, |
60 | 60 | _convert_xml_to_blob_list, |
| 61 | + _convert_xml_to_blob_name_list, |
61 | 62 | _parse_container, |
62 | 63 | _parse_snapshot_blob, |
63 | 64 | _parse_lease, |
@@ -1243,14 +1244,66 @@ def list_blobs(self, container_name, prefix=None, num_results=None, include=None |
1243 | 1244 | args = (container_name,) |
1244 | 1245 | kwargs = {'prefix': prefix, 'marker': marker, 'max_results': num_results, |
1245 | 1246 | 'include': include, 'delimiter': delimiter, 'timeout': timeout, |
1246 | | - '_context': operation_context} |
| 1247 | + '_context': operation_context, |
| 1248 | + '_converter': _convert_xml_to_blob_list} |
| 1249 | + resp = self._list_blobs(*args, **kwargs) |
| 1250 | + |
| 1251 | + return ListGenerator(resp, self._list_blobs, args, kwargs) |
| 1252 | + |
| 1253 | + def list_blob_names(self, container_name, prefix=None, num_results=None, |
| 1254 | + include=None, delimiter=None, marker=None, |
| 1255 | + timeout=None): |
| 1256 | + ''' |
| 1257 | + Returns a generator to list the blob names under the specified container. |
| 1258 | + The generator will lazily follow the continuation tokens returned by |
| 1259 | + the service and stop when all blobs have been returned or num_results is reached. |
| 1260 | +
|
| 1261 | + If num_results is specified and the account has more than that number of |
| 1262 | + blobs, the generator will have a populated next_marker field once it |
| 1263 | + finishes. This marker can be used to create a new generator if more |
| 1264 | + results are desired. |
| 1265 | +
|
| 1266 | + :param str container_name: |
| 1267 | + Name of existing container. |
| 1268 | + :param str prefix: |
| 1269 | + Filters the results to return only blobs whose names |
| 1270 | + begin with the specified prefix. |
| 1271 | + :param int num_results: |
| 1272 | + Specifies the maximum number of blobs to return, |
| 1273 | + including all :class:`BlobPrefix` elements. If the request does not specify |
| 1274 | + num_results or specifies a value greater than 5,000, the server will |
| 1275 | + return up to 5,000 items. Setting num_results to a value less than |
| 1276 | + or equal to zero results in error response code 400 (Bad Request). |
| 1277 | + :param ~azure.storage.blob.models.Include include: |
| 1278 | + Specifies one or more additional datasets to include in the response. |
| 1279 | + :param str delimiter: |
| 1280 | + When the request includes this parameter, the operation |
| 1281 | + returns a :class:`~azure.storage.blob.models.BlobPrefix` element in the |
| 1282 | + result list that acts as a placeholder for all blobs whose names begin |
| 1283 | + with the same substring up to the appearance of the delimiter character. |
| 1284 | + The delimiter may be a single character or a string. |
| 1285 | + :param str marker: |
| 1286 | + An opaque continuation token. This value can be retrieved from the |
| 1287 | + next_marker field of a previous generator object if num_results was |
| 1288 | + specified and that generator has finished enumerating results. If |
| 1289 | + specified, this generator will begin returning results from the point |
| 1290 | + where the previous generator stopped. |
| 1291 | + :param int timeout: |
| 1292 | + The timeout parameter is expressed in seconds. |
| 1293 | + ''' |
| 1294 | + operation_context = _OperationContext(location_lock=True) |
| 1295 | + args = (container_name,) |
| 1296 | + kwargs = {'prefix': prefix, 'marker': marker, 'max_results': num_results, |
| 1297 | + 'include': include, 'delimiter': delimiter, 'timeout': timeout, |
| 1298 | + '_context': operation_context, |
| 1299 | + '_converter': _convert_xml_to_blob_name_list} |
1247 | 1300 | resp = self._list_blobs(*args, **kwargs) |
1248 | 1301 |
|
1249 | 1302 | return ListGenerator(resp, self._list_blobs, args, kwargs) |
1250 | 1303 |
|
1251 | 1304 | def _list_blobs(self, container_name, prefix=None, marker=None, |
1252 | 1305 | max_results=None, include=None, delimiter=None, timeout=None, |
1253 | | - _context=None): |
| 1306 | + _context=None, _converter=None): |
1254 | 1307 | ''' |
1255 | 1308 | Returns the list of blobs under the specified container. |
1256 | 1309 |
|
@@ -1319,7 +1372,7 @@ def _list_blobs(self, container_name, prefix=None, marker=None, |
1319 | 1372 | 'timeout': _int_to_str(timeout), |
1320 | 1373 | } |
1321 | 1374 |
|
1322 | | - return self._perform_request(request, _convert_xml_to_blob_list, operation_context=_context) |
| 1375 | + return self._perform_request(request, _converter, operation_context=_context) |
1323 | 1376 |
|
1324 | 1377 | def get_blob_account_information(self, container_name=None, blob_name=None, timeout=None): |
1325 | 1378 | """ |
|
0 commit comments