-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from azuki774/add-mf
Add money-forward fetcher
- Loading branch information
Showing
10 changed files
with
377 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Pytest | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
jobs: | ||
pytest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.13' | ||
- name: install requirements.txt | ||
run: pip install -r src/moneyforward/requirements.txt | ||
- name: Run pytest | ||
run: pytest -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,4 @@ deployment/*.jpg | |
compose.yml | ||
*-token.env | ||
tmp | ||
src/moneyforward/__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM python:3.13-bookworm | ||
|
||
# Required Packages | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
curl \ | ||
unzip \ | ||
wget \ | ||
unzip \ | ||
libglib2.0-0 \ | ||
libnss3 \ | ||
libgconf-2-4 \ | ||
libfontconfig1 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Chrome | ||
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - | ||
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list | ||
RUN apt-get update && apt-get install -y google-chrome-stable && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Install driver (Ref. https://sleepless-se.net/2024/03/19/python-selenium-docker/) | ||
RUN wget -O chrome.json https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json && \ | ||
LINUX_STABLE_URL=$(grep -oP '"url":".*?(?=")' chrome.json | grep 'linux64' | head -n 1 | cut -d'"' -f4) && \ | ||
wget -O chrome.zip $LINUX_STABLE_URL && \ | ||
unzip chrome.zip && \ | ||
rm chrome.zip chrome.json | ||
|
||
# AWS Setup | ||
RUN curl -o /var/tmp/awscli.zip https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip && \ | ||
unzip -d /usr/local/bin/ /var/tmp/awscli.zip | ||
|
||
# Install Python module | ||
COPY /src/moneyforward/requirements.txt /tmp/ | ||
RUN pip install --upgrade pip && pip install -r /tmp/requirements.txt && mkdir -p /data | ||
COPY --chmod=755 build/moneyforward/main.sh /src/main.sh | ||
COPY src/moneyforward/ /src/ | ||
|
||
ENTRYPOINT ["/src/main.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from selenium import webdriver | ||
from selenium.webdriver.chrome.service import Service as ChromeService | ||
from webdriver_manager.chrome import ChromeDriverManager | ||
import os | ||
|
||
def get_driver(): | ||
options=webdriver.ChromeOptions() | ||
options.add_argument("--headless") | ||
options.add_argument("--no-sandbox") | ||
options.add_argument("--disable-gpu") | ||
options.add_argument("--lang=ja-JP") | ||
options.add_argument("--disable-dev-shm-usage") | ||
# options.add_experimental_option("prefs", {"download.default_directory": "/data/" }) | ||
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36" | ||
options.add_argument("--user-agent=" + UA) | ||
driver = webdriver.Chrome(options=options) | ||
driver.implicitly_wait(10) | ||
return driver |
Oops, something went wrong.