boto

Make a file in s3 public using python and boto

▼魔方 西西 提交于 2019-12-21 06:59:07
问题 I have thins link below, and when I try to acess it it appears an xml file saying "Acess denied". And I need to go to aws managment console and make this part-0000 file public so I can acess it. Do you know how can I give permissions using boto with python so I can acess this link without needed to go to aws managmet console and make the file public? downloadLink = 'https://s3.amazonaws.com/myFolder/uploadedfiles/2015423/part-00000' 回答1: This should give you an idea: import boto.s3 conn =

Error “Could not load Boto's S3 bindings.”

谁都会走 提交于 2019-12-21 03:35:24
问题 I have followed the very terse guide provided for django-storages, transitioned from local file storage, and have come up against this exception: Could not load Boto's S3 bindings. settings.py DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' AWS_ACCESS_KEY_ID = "xxxxxx" AWS_SECRET_ACCESS_KEY = "xxxxxxxxx" AWS_STORAGE_BUCKET_NAME = "images" models.py class CameraImage(models.Model): ... image = models.ImageField(upload_to='images')#get_image_path) What does that exception mean?

How to get the region of the current user from boto?

独自空忆成欢 提交于 2019-12-21 03:13:13
问题 Problem: I'm trying to get the region of the authenticated user from boto3. Use case: I'm working on adding cache to https://github.com/pmazurek/aws-fuzzy-finder. I would prefer to cache the result on per-region basis. This package uses boto to get user authentication data (keys and the region). The problem is the region is never passed explicitly by the user, its being taken from one of the many murky places that boto reads so I don't really have a way of getting it. I have tried searching

The role defined for the function cannot be assumed by Lambda

爷,独闯天下 提交于 2019-12-21 03:11:02
问题 I'm getting the error "The role defined for the function cannot be assumed by Lambda" when I'm trying to create a lambda function with create-function command. aws lambda create-function --region us-west-2 --function-name HelloPython --zip-file fileb://hello_python.zip --role arn:aws:iam::my-acc-account-id:role/default --handler hello_python.my_handler --runtime python2.7 --timeout 15 --memory-size 512 回答1: I got the error "The role defined for the function cannot be assumed by Lambda"

Upload image available at public URL to S3 using boto

半城伤御伤魂 提交于 2019-12-20 08:40:30
问题 I'm working in a Python web environment and I can simply upload a file from the filesystem to S3 using boto's key.set_contents_from_filename(path/to/file). However, I'd like to upload an image that is already on the web (say https://pbs.twimg.com/media/A9h_htACIAAaCf6.jpg:large). Should I somehow download the image to the filesystem, and then upload it to S3 using boto as usual, then delete the image? What would be ideal is if there is a way to get boto's key.set_contents_from_file or some

When I use python boto connect to aws ec2 , it show SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)

大憨熊 提交于 2019-12-20 07:56:36
问题 I'm using Windows 10 OS. I want to count the number of IP Address of AWS. I use python 2.7.14 and boto 2.6.0 I add a file which name is boto.config locate C:\Users\Administrator folder The content of the boto.config is: [Credentials] aws_access_key_id=****** aws_secret_access_key=***** The script is : #!/usr/bin/env python # -*- encoding: utf8 -*- import boto.ec2 from pprint import pprint import ssh import requests import urllib3 import certifi import ssl conn = boto.ec2.connect_to_region('cn

AWS BOTO : No handler After configuration

ⅰ亾dé卋堺 提交于 2019-12-20 07:48:09
问题 I'm deploying my Django application on ec2 on AWS. I did configuration setting up ~/.boto and finally succeed in 'python manage.py collectstatic'. If there is an error, then error is caused! (I know because I solved it by setting up ~/.boto configuration file!). But after configuration , when I query my image file at S3 mapped to my imageField model, it shows the error message below: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials I

utf8' codec can't decode byte 0x89 in position 15: invalid start byte

对着背影说爱祢 提交于 2019-12-20 06:16:47
问题 This is a view for my project in which I am trying to upload images from my local system to s3 using boto. class ImageList(generics.ListCreateAPIView): queryset = Image.objects.all() serializer_class = ImageSerializer def post(self , request , format = None): # import ipdb; ipdb.set_trace() serializer = ImageSerializer(data = request.data) if serializer.is_valid(): serializer.save() print request.data return Response({'received data' : request.data}) return Response(serializer.errors , status

Reading part of a file in S3 using Boto

守給你的承諾、 提交于 2019-12-20 02:48:19
问题 I am trying to read 700MB file stored in S3. How ever I only require bytes from locations 73 to 1024. I tried to find a usable solution but failed to. Would be a great help if someone could help me out. 回答1: S3 supports GET requests using the 'Range' HTTP header which is what you're after. To specify a Range request in boto, just add a header dictionary specifying the 'Range' key for the bytes you are interested in. Adapted from Mitchell Garnaat's response: import boto s3 = boto.connect_s3()

Unreliable performance downloading files from S3 with boto and multiprocessing.Pool

断了今生、忘了曾经 提交于 2019-12-19 11:22:29
问题 I want to download thousands of files from S3. To speed up the process I tried out Python's multiprocessing.Pool, but I the performance is very unreliable. Sometimes it works and it's much faster than the single core version, but often some files take several seconds so that the multiprocessing run takes longer than the single process one. A few times I even get a ssl.SSLError: The read operation timed out . What could be the reason for that? from time import time from boto.s3.connection