From 0ec86ea1b2374fea9c14ab1dd88b3c153825fc94 Mon Sep 17 00:00:00 2001 From: m417z Date: Sat, 16 Oct 2021 22:16:01 +0300 Subject: [PATCH] No Python buffering, remove old Travis deploy file, add timeout to VT requests --- .github/workflows/deploy.yml | 4 ++-- .travis.yml | 23 ----------------------- data/upd04_get_virustotal_data.py | 8 +++++++- 3 files changed, 9 insertions(+), 26 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d7f341bb4d7a..88935fb69fc7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,9 +37,9 @@ jobs: run: | python -m pip install --upgrade pip pip install 'git+git://github.com/m417z/pymultitor.git' 'mitmproxy==6.*' orjson requests - - name: Run Periodic Update + - name: Run periodic update run: | cd data - python deploy.py + python -u deploy.py env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5f69caf2d2d6..000000000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: python -python: - - "3.8" -before_install: - - sudo apt-get -y install aria2 - - sudo apt-get -y install cabextract -addons: - apt: - update: true -install: - - pip install orjson requests -script: - - cd data - - python deploy.py -git: - depth: 1 - -# https://github.com/ebu/ebu-tt-live-toolkit/issues/139#issuecomment-324696334 -# Build all branches, *including* gh-pages: -branches: - only: - - gh-pages - - /.*/ diff --git a/data/upd04_get_virustotal_data.py b/data/upd04_get_virustotal_data.py index 9e42aa4d126e..ca100338ece2 100644 --- a/data/upd04_get_virustotal_data.py +++ b/data/upd04_get_virustotal_data.py @@ -51,7 +51,13 @@ def get_virustotal_data_for_file(session, file_hash, output_dir): # Sorry... 'X-VT-Anti-Abuse-Header': base64.b64encode(f'{random.randint(10000000000, 20000000000)}-ZG9udCBiZSBldmls-{round(time.time(), 3)}'.encode()).decode(), } - r = session.get(url, verify=False, headers=headers) + + r = None + try: + r = session.get(url, verify=False, headers=headers, timeout=60*10) + except: + return 'retry' + if r.status_code == 429: return 'retry'