SwiftService list in 3.13.1 throws "No tenant specified" on iterating with __iter__ through results
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-swiftclient |
New
|
Undecided
|
Unassigned |
Bug Description
I tried to use the example in https:/
Converting to a minimal example to focus the bug:
```python
from swiftclient.client import Connection
from swiftclient.service import SwiftService
_authurl = XXX
_key = XXX
_tenant = 'my_tenant'
minimum_size = 10*1024**2
conn = Connection(
preauthurl =_authurl,
preauthtoken =_key,
os_options = {"tenant_
}
)
resp_headers, containers = conn.get_account()
for container in containers:
print(
with SwiftService() as swift:
# works as expected
list_parts_gen = swift.list(
next(
# will raise error on iterating
list_parts_gen = swift.list(
for list in list_parts_gen:
print(list)
break
```
On execution the __next__ on the iterator works as expected:
```json
{'bytes': 1522284, 'hash': 'e4076afb2c4eaa
```
But doing the same with __iter__ on the iterator raises:
```json
{'action': 'list_container
```
Actually the tenant is defined in the container object itself but much more important, there shouldn't a difference in handling the iterator with __next__ or __iter__. I tried to find the source for this problem but wasn't able to.
I tried to add in the SwiftService() object after initialization with the necessary `os_options` dict but this leads to Type error.