Why are no Amazon S3 authentication handlers ready?

后端 未结 12 2151
广开言路
广开言路 2020-12-13 08:21

I have my $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY environment variables set properly, and I run this code:

import boto
conn = boto.connect_s3()
         


        
12条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 08:59

    I'm a newbie to both python and boto but was able to reproduce your error (or at least the last line of your error.)

    You are most likely failing to export your variables in bash. if you just define then, they're only valid in the current shell, export them and python inherits the value. Thus:

    $ AWS_ACCESS_KEY_ID="SDFGRVWGFVVDWSFGWERGBSDER"
    

    will not work unless you also add:

    $ export AWS_ACCESS_KEY_ID
    

    Or you can do it all on the same line:

    $ export AWS_ACCESS_KEY_ID="SDFGRVWGFVVDWSFGWERGBSDER"
    

    Likewise for the other value. You can also put this in your .bashrc (assuming bash is your shell and assuming you remember to export)

提交回复
热议问题