Skip to content

Commit 7d21152

Browse files
committed
not fallback to get request on 405 only
We will attempt to send a head request then get request on all urls until a request returns 200 or the retries are 0
1 parent 75e863d commit 7d21152

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

CHANGELOG.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@ All notable changes to this project will be documented in this file.
1212

1313
### Other Changes
1414

15+
## [v0.2.2] 8 Nov 2024
16+
17+
- Change Broken URLs flagging to always try head and get request on any URL before flagging it as broken.
18+
1519
## [v0.2.1] 7 Aug 2024
20+
1621
- Fix command line list[str] type issue and use Click.IntRange for retries and timeout.
1722

1823
## [v0.2.0] 7 Aug 2024
24+
1925
- Redesign the package.
2026
- Port to using Click instead of arg_parser.
2127
- Expose options for external users to allow for more customization.
@@ -30,9 +36,11 @@ All notable changes to this project will be documented in this file.
3036
- Add support for GitHub automatic annotations.
3137

3238
## [v0.1.5] 8 Jul 2024
39+
3340
- Increase timeout for requests to check web urls alive or not. https://github.com/john0isaac/markdown-checker/pull/52
3441

3542
## [v0.1.4] 6 May 2024
43+
3644
- Improve Dev Experience. https://github.com/john0isaac/markdown-checker/pull/28
3745
- Better Typing. https://github.com/john0isaac/markdown-checker/pull/37
3846
- Add ruff, black, mypy and workflows to check them on all supported python versions.
@@ -41,23 +49,27 @@ All notable changes to this project will be documented in this file.
4149
- Add docs in read the docs https://markdown-checker.readthedocs.io/en/latest/
4250

4351
## [v0.1.3] 15 March 2024
44-
* Change lessons to files
45-
* Remove ID's from the end of Relative Paths
52+
53+
- Change lessons to files
54+
- Remove ID's from the end of Relative Paths
4655

4756
## [v0.1.2] 06 March 2024
48-
* Improve-package by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/21
49-
* Skipped vs code redirect urls
50-
* fixed typos
57+
58+
- Improve-package by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/21
59+
- Skipped vs code redirect urls
60+
- fixed typos
5161

5262
## [v0.1.1] 06 March 2024
53-
* fix: add requests to required packages by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/19
63+
64+
- fix: add requests to required packages by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/19
5465

5566
## [v0.1.0] 06 March 2024
56-
* add development requirements and install in devcontainer by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/13
57-
* format with ruff and black by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/14
58-
* improve output of checker by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/15
59-
* feat: broken urls by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/16
60-
* Skip microsoft security blog by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/17
67+
68+
- add development requirements and install in devcontainer by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/13
69+
- format with ruff and black by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/14
70+
- improve output of checker by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/15
71+
- feat: broken urls by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/16
72+
- Skip microsoft security blog by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/17
6173

6274
## [v0.0.9] 05 March 2024
6375

@@ -71,7 +83,6 @@ All notable changes to this project will be documented in this file.
7183
- define tests to execute functions
7284
- docs: add instructions for local development
7385

74-
7586
## [v0.0.7] 26 November 2023
7687

7788
- Rename get_input_args to inputs module with no change.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "markdown-checker"
33
description= "A markdown link validation reporting tool."
4-
version = "0.2.1"
4+
version = "0.2.2"
55
authors = [{ name = "John Aziz", email = "[email protected]" }]
66
maintainers = [{ name = "John Aziz", email = "[email protected]" }]
77
license = {file = "LICENSE"}

src/markdown_checker/urls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ def is_alive(self, timeout: int = 10, retries: int = 3) -> bool:
4343
response = requests.head(self.link, timeout=timeout, allow_redirects=True)
4444
if response.status_code == 200:
4545
return True
46-
elif response.status_code == 405:
46+
else:
4747
response = requests.get(self.link, timeout=timeout, allow_redirects=True)
48-
return response.status_code == 200
48+
if response.status_code == 200:
49+
return True
4950
except requests.RequestException:
5051
continue
5152
time.sleep(1)

0 commit comments

Comments
 (0)