Skip to content

Commit 3540d9d

Browse files
combining exporters in one image (step 3)
- tested on course_to_spreadsheet_exporter.py
1 parent 1f86c26 commit 3540d9d

24 files changed

+571
-387
lines changed

common_grade_export/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.13-slim
2+
3+
WORKDIR /app
4+
ENV PYTHONPATH="/app"
5+
6+
COPY requirements.txt .
7+
RUN pip install --no-cache-dir -r requirements.txt
8+
9+
COPY src/ .
10+
11+
ENTRYPOINT [ "python3" ]

common_grade_export/checker_export/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

common_grade_export/checker_export/requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

common_grade_export/moodle_export/README.md

Lines changed: 0 additions & 74 deletions
This file was deleted.

common_grade_export/moodle_export/requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
requests==2.32.5
2+
#requests-oauthlib==1.3.1
3+
pygsheets==2.0.6 # TODO: change on gspread
4+
pandas==2.3.0
5+
yadisk==3.4.0
6+
openpyxl==3.1.5
7+
gspread==6.2.1

common_grade_export/run.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
cd common_grade_export
4+
5+
docker build -t 'grade_exporter:latest' .
6+
7+
8+
SYSTEM_CRED=/tmp/system_cred.json
9+
10+
cat > $SYSTEM_CRED <<EOF
11+
{
12+
"moodle": "$MOODLE_TOKEN",
13+
"dis": "$DIS_ACCESS_TOKEN",
14+
"stepik": {
15+
"client_id": "$STEPIK_CLIENT_ID",
16+
"client_secret": "$STEPIK_CLIENT_SECRET"
17+
}
18+
}
19+
EOF
20+
21+
22+
TABLE_ID=$TABLE_ID
23+
SHEET_ID=$SHEET_ID
24+
GOOGLE_CRED=$EXPORTER_GOOGLE_CONF
25+
26+
GOOGLE_CRED_DOCKER_PATH=/app/secret.json
27+
CRED_DOCKER_PATH=/app/system_cred.json
28+
29+
docker run --rm grade_exporter:latest -v $GOOGLE_CRED:$GOOGLE_CRED_DOCKER_PATH -v $SYSTEM_CRED:$CRED_DOCKER_PATH course_to_spreadsheet_exporter.py --table_id $TABLE_ID --sheet_id $SHEET_ID --google_cred $GOOGLE_CRED_DOCKER_PATH --system_cred $CRED_DOCKER_PATH
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.json
2+
*.csv

common_grade_export/src/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.csv
2+
*.log
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
import sys
33
from io import StringIO
4-
from download_file import download_sheet, get_sheets_service_and_token
4+
from utils.download_file import download_sheet, get_sheets_service_and_token
55

66
logging.basicConfig(
77
level=logging.INFO,

0 commit comments

Comments
 (0)