boto

Why are my compressed files on S3 returning a 403 Forbidden error?

一曲冷凌霜 提交于 2019-12-06 05:24:10
I'm using django-compressor and django-storages to serve my compressed files on S3 (using these instructions: http://django_compressor.readthedocs.org/en/latest/remote-storages/#using-staticfiles ). It works great initially after running the "compress" management command, but after about one hour the compressed css and js files return a 403 Forbidden error even though I haven't made any changes to the files. I can't seem to isolate the problem, so any help would be appreciated. Here are the settings I am using: COMPRESS_ENABLED = True COMPRESS_URL = "http://mybucket.s3.amazonaws.com/" COMPRESS

Boto DynamoDB2 conditional put_item

可紊 提交于 2019-12-06 04:35:53
问题 I am trying to have put_item to check if there is item with the same HashKey before actually adding the new item. According to boto DynamoDB2 document, it is possible to do it with "Conditional Put". I tried following command but no luck. connection.put_item('table',item={'locationId':'a1', 'timestamp': time.time()}, expected={'locationID':False}) The error message is as following. boto.exception.JSONResponseError: JSONResponseError: 400 Bad Request {u'Message': u'Expected null', u'__type': u

Read a csv file from aws s3 using boto and pandas

☆樱花仙子☆ 提交于 2019-12-06 02:42:36
问题 I have already read through the answers available here and here and these do not help. I am trying to read a csv object from S3 bucket and have been able to successfully read the data using the following code. srcFileName="gossips.csv" def on_session_started(): print("Starting new session.") conn = S3Connection() my_bucket = conn.get_bucket("randomdatagossip", validate=False) print("Bucket Identified") print(my_bucket) key = Key(my_bucket,srcFileName) key.open() print(key.read()) conn.close()

Getting Credentials File in the boto.cfg for Python

我是研究僧i 提交于 2019-12-06 02:35:29
I'm using AWS for the first time and have just installed boto for python. I'm stuck at the step where it advices to: "You can place this file either at /etc/boto.cfg for system-wide use or in the home directory of the user executing the commands as ~/.boto." Honestly, I have no idea what to do. First, I can't find the boto.cfg and second I'm not sure which command to execute for the second option. Also, when I deploy the application to my server, I'm assuming I need to do the same thing there too... Steffen Opel "You can place this file either at /etc/boto.cfg for system-wide use or in the

aws boto sns - get endpoint_arn by device token

試著忘記壹切 提交于 2019-12-06 02:12:35
问题 Currently, If we want to add a device to an SNS application using: ep = SNSConnection.create_platform_endpoint(app_arn,device_token,user_data) There is an option that the device was already added in the past. To verify if the device is already added, we're using: def is_device_registered(device_token): list_of_endpoints = SNSConnection.list_endpoints_by_platform_application(AC.INPLAY_CHAT_APPLICATION_SNS_ARN) all_app_endpoints = list_of_endpoints['ListEndpointsByPlatformApplicationResponse'][

Boto S3 API does not return full list of keys

大兔子大兔子 提交于 2019-12-06 01:47:21
问题 I use boto S3 API in my python script which slowly copies data from S3 to my local filesystem. The script worked well for a couple of days, but now there is a problem. I use the following API function to obtain the list of keys in "directory": keys = bucket.get_all_keys(prefix=dirname) And this function ( get_all_keys ) does not always return the full list of keys, I mean I can see more keys through AWS web-interface or via aws s3 ls s3://path . Reproduced the issue on versions 2.15 and 2.30.

Polling a stopping or starting EC2 instance with Boto

北城以北 提交于 2019-12-05 21:43:01
问题 I'm using AWS, Python, and the Boto library. I'd like to invoke .start() or .stop() on a Boto EC2 instance, then "poll" it until it has completed either. import boto.ec2 credentials = { 'aws_access_key_id': 'yadayada', 'aws_secret_access_key': 'rigamarole', } def toggle_instance_state(): conn = boto.ec2.connect_to_region("us-east-1", **credentials) reservations = conn.get_all_reservations() instance = reservations[0].instances[0] state = instance.state if state == 'stopped': instance.start()

Trouble setting cache-cotrol header for Amazon S3 key using boto

只谈情不闲聊 提交于 2019-12-05 17:22:06
My Django project uses django_compressor to store JavaScript and CSS files in an S3 bucket via boto via the django-storages package. The django-storages-related config includes if 'AWS_STORAGE_BUCKET_NAME' in os.environ: AWS_STORAGE_BUCKET_NAME = os.environ['AWS_STORAGE_BUCKET_NAME'] AWS_HEADERS = { 'Cache-Control': 'max-age=100000', 'x-amz-acl': 'public-read', } AWS_QUERYSTRING_AUTH = False # This causes images to be stored in Amazon S3 DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' # This causes CSS and other static files to be served from S3 as well. STATICFILES_STORAGE =

Is boto library thread-safe?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 16:37:01
问题 Specifically I'm interested in using a DynamoDB table object from multiple threads (puts, gets, updates, etc). If that's not safe, then is there a safe way (i.e., maybe one table object per thread)? Any other gotchas or tips about working with threads in boto appreciated. 回答1: The boto library uses httplib which has never been, and to my knowledge still is not, thread-safe. The workaround is to make sure each thread creates its own connection to DynamoDB and you should be good. 来源: https:/

How do I loop over all items in a DynamoDB table using boto?

喜你入骨 提交于 2019-12-05 14:53:20
I'd like to query a DynamoDB table and retrieve all the items and loop over them using boto. How do I structure a query or scan that returns everything in the table? Preliminary support for the Scan API had been added to boto's layer2 for DynamoDB by Chris Moyer in commit 522e0548 ( Added scan to layer2 and Table ) and has meanwhile been updated by Mitch Garnaat in commit adeb7151 ( Cleaned up the scan method on Layer2 and Table. ) to hide the layer1 details and enable intuitive querying - the respective issue #574 is currently scheduled to be released with boto 2.3 . A usage sample is