asselinpaul
asselinpaul

Reputation: 386

Python S3 Boto generates Urls with SignatureDoesNotMatch Error

        import boto
        from boto.s3.connection import S3Connection
        import requests

        conn = S3Connection('-----------------', '-------------------')
        snapsbucket = conn.get_bucket('snaps-snaps')

        for key in snapsbucket.list('a'):
            print key.name    
            print key.generate_url(expires_in=90)

This will output a list of filenames and urls. When I follow a url, I get the following xml:

        <Error>
        <Code>SignatureDoesNotMatch</Code>
        <Message>
        The request signature we calculated does not match the signature you provided. Check your key and signing method.
        </Message>
        <StringToSignBytes>
        47 45 54 0a 0a 0a 31 33 39 37 30 38 34 30 35 37 0a 2f 73 6e 61 70 73 2d 73 6e 61 70 73 2f 61 73 73 65 6c 69 6e 70 61 75 6c 5f 61 73 73 65 6c 69 6e 70 61 75 6c 7e 31 33 39 36 39 38 36 38 37 39 34 36 35 2e 6d 70 34
        </StringToSignBytes>
        <RequestId>2C2A6E1194BAAD85</RequestId>
        <HostId>
        ReNCy1k3OqBd2xyfA5tyixhD7MXnNACqBspsl61IAN7GSF1haK03cv4r6x6WHle/
        </HostId>
        <SignatureProvided>IlRoL9AZJZQYL4/L0wySexMBjnw=</SignatureProvided>
        <StringToSign>
        GET 1397084057 /snaps-snaps/asselinpaul_asselinpaul~1396986879465.mp4
        </StringToSign>
        <AWSAccessKeyId>--------------</AWSAccessKeyId>
        </Error>

Stuck here, any help much appreciated.

Upvotes: 1

Views: 1026

Answers (1)

asselinpaul
asselinpaul

Reputation: 386

It turns out my filenames contained a tilde (~).

This would mess up the urls, thus the error.

Upvotes: 1

Related Questions