Skip to content

Commit 8cf1af9

Browse files
committed
update expiration days
1 parent 6ae5b80 commit 8cf1af9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/ps_helper/cli/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def create_report(metrics_path):
4040
click.echo(f"📊 Generating report from '{metrics_path}'...")
4141

4242
try:
43-
report_path = generate_html_report(metrics_path)
43+
report_path, _ = generate_html_report(metrics_path)
4444
click.echo(f"✅ Report generated successfully: {report_path}")
4545

4646
except FileNotFoundError:

src/ps_helper/extensions/metrics_extension.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ def _upload_report_to_s3(self, html_content, spider):
219219
"""Upload HTML report to S3 from memory"""
220220

221221
bucket_name = os.getenv('S3_BUCKET_NAME')
222+
223+
expiration_days = int(os.getenv('REPORT_EXPIRATION_DAYS', '3'))
224+
expiration_seconds = expiration_days * 24 * 3600
225+
222226
timestamp = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')
223227
key = f"scrapy-reports/{spider.name}/{timestamp}-report.html"
224228

@@ -227,7 +231,7 @@ def _upload_report_to_s3(self, html_content, spider):
227231
bucket=bucket_name,
228232
key=key,
229233
publico=False,
230-
expira_seg=3 * 24 * 3600
234+
expira_seg=expiration_seconds
231235
)
232236

233237
return url

src/ps_helper/scripts/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def upload_html_to_s3(
77
bucket: str,
88
key: str = None,
99
publico: bool = False,
10-
expira_seg: int = 30 * 24 * 3600
10+
expira_seg: int = 3 * 24 * 3600
1111
):
1212
"""
1313
Uploads HTML to S3 from memory.

0 commit comments

Comments
 (0)