Commit cc10d35
authored
Modify URL validation method and error handling (#159)
feat: optimize URL validation to use HEAD requests by default
Update validate_url_200 to default get_method to requests.head for improved efficiency.
Implement fallback to GET for specific status codes (403, 405, 501) to handle servers that reject HEAD requests.
It is worth noting that this change does not resolve 429 Too Many Requests errors. Because HEAD requests are still requests, they count toward your total traffic quota on the target server. By design, this function honors the server's rate-limiting policy, it does not bypass it. If you encounter a 429 error, the function will correctly raise a ValidationError as expected, signaling that the application needs to implement backoff or throttling logic rather than attempting to "fix" the request method.1 parent 2b9890d commit cc10d35
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
| |||
0 commit comments