diff options
| author | Yuval Adam <_@yuv.al> | 2017-11-17 15:56:30 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2017-11-17 15:56:30 +0200 |
| commit | 5861ad0fefe67fc5c40c46069c0aa337745eda8e (patch) | |
| tree | 493fd2745abed85df06a5b9e9fb6efea60086a16 | |
| parent | 1c703284cfa73350b794d50795133f2c2ea26f0b (diff) | |
Update MIME types and cache headers
| -rw-r--r-- | cron/.gitignore | 5 | ||||
| -rw-r--r-- | cron/handler.py | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/cron/.gitignore b/cron/.gitignore index 84c61a9..22e4d37 100644 --- a/cron/.gitignore +++ b/cron/.gitignore @@ -16,5 +16,8 @@ var/ .installed.cfg *.egg +__pycache__ +*.pyc + # Serverless directories -.serverless
\ No newline at end of file +.serverless diff --git a/cron/handler.py b/cron/handler.py index 100041e..64f96e8 100644 --- a/cron/handler.py +++ b/cron/handler.py @@ -37,7 +37,7 @@ def geshem_update(): if latest_keys: if key not in latest_keys: - client.put_object(Bucket=BUCKET, Key=key, Body=img) + client.put_object(Bucket=BUCKET, Key=key, Body=img, ContentType='image/png', CacheControl='public, max-age=31536000') latest_keys.append(key) response += 'Put {}, '.format(key) else: @@ -57,7 +57,7 @@ def geshem_update(): keys = sorted(list(filter(lambda k: k.endswith('{}.png'.format(r)), latest_keys)))[-10:] index[r] = keys client.put_object(Bucket=BUCKET, Key='imgs.json', Body=json.dumps(index), - ContentType='application/json', Expires=datetime.utcnow() + timedelta(minutes=1)) + ContentType='application/json', CacheControl='public, max-age=60') return response |
