我正尝试在S3上访问以行分隔的JSON数据。根据我对文档的理解,我应该能够这样做
print data(S3(Chunks(JSONLines))('s3://KEY:SECRET@bucket/dir/part-*.json').peek()这抛出了
BotoClientError: BotoClientError: Bucket names cannot contain upper-case characters when using either the sub-domain or virtual hosting calling format.我已经尝试过这方面的变化,导致了不同的错误。
我可以让以下代码与本地文件一起使用:
print data(chunks(JSONLines)(map(JSONLines, glob("/home/me/data/*")))).peek()不过,我不太确定为什么需要(map(JSONLines, glob(。
我真的不知道如何使用type-modofiers
发布于 2017-03-10 05:26:26
在本页的示例6的注释部分中,http://www.programcreek.com/python/example/51587/boto.exception.BotoClientError指出:
存储桶名称不能包含大写字符。我们通过添加一个小写字符并使用islower()进行测试来检查这一点。注意:这也涵盖了数字存储桶名称和破折号等情况。
此评估使用的函数是check_lowercase_bucketname(n),通过我们获得的示例调用:
>>> check_lowercase_bucketname("Aaaa")
Traceback (most recent call last):
...
BotoClientError: S3Error: Bucket names cannot contain upper-case
characters when using either the sub-domain or virtual hosting calling
format.
>>> check_lowercase_bucketname("1234-5678-9123")
True
>>> check_lowercase_bucketname("abcdefg1234")
True上面提到的内容使我相信您对's3://KEY:SECRET@bucket/dir/part-*.json'的调用不会通过,因为密钥和/或SECRET变量包含UpperCase或不允许的字符
https://stackoverflow.com/questions/42603299
复制相似问题