Skip to content

Commit

Permalink
not fallback to get request on 405 only
Browse files Browse the repository at this point in the history
We will attempt to send a head request then get request on all urls until a request returns 200 or the retries are 0
  • Loading branch information
john0isaac committed Nov 8, 2024
1 parent 75e863d commit 7d21152
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
35 changes: 23 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ All notable changes to this project will be documented in this file.

### Other Changes

## [v0.2.2] 8 Nov 2024

- Change Broken URLs flagging to always try head and get request on any URL before flagging it as broken.

## [v0.2.1] 7 Aug 2024

- Fix command line list[str] type issue and use Click.IntRange for retries and timeout.

## [v0.2.0] 7 Aug 2024

- Redesign the package.
- Port to using Click instead of arg_parser.
- Expose options for external users to allow for more customization.
Expand All @@ -30,9 +36,11 @@ All notable changes to this project will be documented in this file.
- Add support for GitHub automatic annotations.

## [v0.1.5] 8 Jul 2024

- Increase timeout for requests to check web urls alive or not. https://github.com/john0isaac/markdown-checker/pull/52

## [v0.1.4] 6 May 2024

- Improve Dev Experience. https://github.com/john0isaac/markdown-checker/pull/28
- Better Typing. https://github.com/john0isaac/markdown-checker/pull/37
- Add ruff, black, mypy and workflows to check them on all supported python versions.
Expand All @@ -41,23 +49,27 @@ All notable changes to this project will be documented in this file.
- Add docs in read the docs https://markdown-checker.readthedocs.io/en/latest/

## [v0.1.3] 15 March 2024
* Change lessons to files
* Remove ID's from the end of Relative Paths

- Change lessons to files
- Remove ID's from the end of Relative Paths

## [v0.1.2] 06 March 2024
* Improve-package by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/21
* Skipped vs code redirect urls
* fixed typos

- Improve-package by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/21
- Skipped vs code redirect urls
- fixed typos

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

- fix: add requests to required packages by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/19

## [v0.1.0] 06 March 2024
* add development requirements and install in devcontainer by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/13
* format with ruff and black by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/14
* improve output of checker by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/15
* feat: broken urls by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/16
* Skip microsoft security blog by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/17

- add development requirements and install in devcontainer by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/13
- format with ruff and black by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/14
- improve output of checker by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/15
- feat: broken urls by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/16
- Skip microsoft security blog by @john0isaac in https://github.com/john0isaac/markdown-checker/pull/17

## [v0.0.9] 05 March 2024

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


## [v0.0.7] 26 November 2023

- Rename get_input_args to inputs module with no change.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "markdown-checker"
description= "A markdown link validation reporting tool."
version = "0.2.1"
version = "0.2.2"
authors = [{ name = "John Aziz", email = "johnaziz269@gmail.com" }]
maintainers = [{ name = "John Aziz", email = "johnaziz269@gmail.com" }]
license = {file = "LICENSE"}
Expand Down
5 changes: 3 additions & 2 deletions src/markdown_checker/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ def is_alive(self, timeout: int = 10, retries: int = 3) -> bool:
response = requests.head(self.link, timeout=timeout, allow_redirects=True)
if response.status_code == 200:
return True
elif response.status_code == 405:
else:
response = requests.get(self.link, timeout=timeout, allow_redirects=True)
return response.status_code == 200
if response.status_code == 200:
return True
except requests.RequestException:
continue
time.sleep(1)
Expand Down

0 comments on commit 7d21152

Please sign in to comment.