SpectraLogic / ds3_python_sdk

Apache License 2.0
8 stars 7 forks source link

'marker' in get_bucket needs to be quoted #64

Closed thattommyhall closed 8 years ago

thattommyhall commented 8 years ago

I am doing the following

def get_blackperl_files():
    result = {}
    step = 10000
    start_from = None
    while True:
        bucketContents = client.get_bucket(ds3.GetBucketRequest(bucketName, max_keys=step, marker=start_from))
        contents_list = bucketContents.result['ContentsList']
        for obj in contents_list:
            keyname = obj['Key']
            result[keyname] = obj
        if len(contents_list) < step:
            return result
        start_from = urllib.quote((contents_list[-1]['Key']))

But I think it's a bug, I should just be able to pass the key name w/o quoting.

thattommyhall commented 8 years ago
 $ python list.py 
starting from: None
starting from: Easy.pdf
starting from: Triathlon Training For Dummies(2008)BBS.pdf
Traceback (most recent call last):
  File "list.py", line 4, in <module>
    for n in get_blackperl_files().keys():
  File "/home/thattommyhall/backup/helpers.py", line 42, in get_blackperl_files
    bucketContents = client.get_bucket(ds3.GetBucketRequest(bucketName, max_keys=step, marker=start_from))
  File "/home/thattommyhall/backup/ds3/ds3.py", line 6713, in get_bucket
    return GetBucketResponse(self.net_client.get_response(request), request)
  File "/home/thattommyhall/backup/ds3/ds3.py", line 5280, in __init__
    self.process_response(response)
  File "/home/thattommyhall/backup/ds3/ds3.py", line 5348, in process_response
    self.__check_status_codes__([200])
  File "/home/thattommyhall/backup/ds3/ds3.py", line 5302, in __check_status_codes__
    raise RequestFailed(err, ds3_error)
ds3.ds3network.RequestFailed: Return Code: Expected [200] - Received 505 
 Code=HTTP Version Not Supported 
 HttpError=505 
 None
rpmoore commented 8 years ago

Is the stack trace a result of not escaping the key?

thattommyhall commented 8 years ago

yeah, without urllib.quote that's what happens

rpmoore commented 8 years ago

We will get a fix for this out after the holiday. Thanks for reporting!

rpmoore commented 8 years ago

The fix should be checked in. It will be included in the next release. Please give it a try and let us know if the issue is still occuring.