Add timeout to POST request (#19)
* fix: add timeout to POST request * fix: CI job could not find Pytest * fix: correct coverage report path * fix: correct coverage source path
This commit is contained in:
3
.coveragerc
Normal file
3
.coveragerc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[coverage:run]
|
||||||
|
relative_files = True
|
||||||
|
branch = True
|
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@ -31,20 +31,11 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
- name: Unit Test
|
- name: Unit Test
|
||||||
run: |
|
run: |
|
||||||
coverage run -m py.test -v --junitxml=testresults.xml
|
coverage run -m pytest -v --junitxml=testresults.xml
|
||||||
coverage xml
|
coverage xml
|
||||||
|
sed -i 's/\/home\/runner\/work\/epage\/epage/\/github\/workspace/g' coverage.xml
|
||||||
- name: SonarCloud Scan
|
- name: SonarCloud Scan
|
||||||
uses: SonarSource/sonarcloud-github-action@master
|
uses: SonarSource/sonarcloud-github-action@master
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CLOUD }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_CLOUD }}
|
||||||
# - name: SonarQube Scan
|
|
||||||
# uses: sonarsource/sonarqube-scan-action@master
|
|
||||||
# env:
|
|
||||||
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
||||||
# - name: SonarQube Quality Gate
|
|
||||||
# uses: sonarsource/sonarqube-quality-gate-action@master
|
|
||||||
# timeout-minutes: 5
|
|
||||||
# env:
|
|
||||||
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
|
@ -26,7 +26,8 @@ def send_page(name: str, email: str, message: str) -> tuple:
|
|||||||
req = requests.post(
|
req = requests.post(
|
||||||
api_url,
|
api_url,
|
||||||
json=payload,
|
json=payload,
|
||||||
headers={'Content-Type': 'application/json'}
|
headers={'Content-Type': 'application/json'},
|
||||||
|
timeout=5
|
||||||
)
|
)
|
||||||
|
|
||||||
if req.status_code == 200 and req.json().get('status') == 1:
|
if req.status_code == 200 and req.json().get('status') == 1:
|
||||||
|
Reference in New Issue
Block a user