Commit Graph

264 Commits

Author SHA1 Message Date
Takeshi KOMIYA
29038c9d4c refactor: linkcheck: Call write_linkstat() at the top of process_result() 2021-04-29 18:19:38 +09:00
Takeshi KOMIYA
a7d3e9684d refactor: linkcheck: Use attributes of CheckResult in process_result() 2021-04-29 18:01:42 +09:00
Takeshi KOMIYA
aeb9e42d2b refactor: Use PEP-526 based variable annotation (sphinx.builders) 2021-03-13 16:37:50 +09:00
Takeshi KOMIYA
725f74f5eb refactor: linkcheck: Remove next_check from Hyperlink object
To separate hyperlink itself and checking (intermediate) state, this
removes `next_check` attribute from Hyperlink object and add a new
named-tuple `CheckRequest`.  It was rejected idea on implementing
rate-limiting first (see #8467).  But it's better way to separate
large builder module into small components and make whole of linkcheck
builder simple.

After this change, `Hyperlink` object represents a hyperlink on the
document.  It has a URI and location info (docname and lineno).
2021-02-13 00:44:02 +09:00
Takeshi KOMIYA
7252abab1c refactor: linkcheck: Refine the constructor of Checker and CheckWorker
Make the constructors of Checker and CheckWorker classes less-coupled
with linkcheck builder.
2021-02-12 23:20:07 +09:00
Takeshi KOMIYA
5c223d20d6 refactor: linkcheck: Separate thread manager feature from builder class
To reduce the complexity of the linkcheck builder, this separates
the thread manager feature from the builder class as
HyperlinkAvailabilityChecker.
2021-02-12 23:19:01 +09:00
Takeshi KOMIYA
899ccfd40e refactor: linkcheck: Deprecate attributes of linkcheck builders
Move anchors_ignore, auth and to_ignore to
HyperlinkAvailabilityCheckWorker and become deprecated.
2021-02-07 02:39:35 +09:00
Takeshi KOMIYA
ad5b0babd7 refactor: linkcheck: Remove unused attribute HyperlinkAvailabilityCheckWorker.app 2021-02-06 01:34:20 +09:00
Takeshi KOMIYA
84130fff40
Fix typo
Co-authored-by: François Freitag <mail@franek.fr>
2021-02-06 01:24:16 +09:00
Takeshi KOMIYA
f02fb7a8cc refactor: linkcheck: Separate worker feature from builder class
To reduce the complexity of the linkcheck builder, this separates
the worker feature from the builder class.
2021-02-05 22:52:28 +09:00
François Freitag
b12a0f33ef
Formalize linkcheck CheckResult into a NamedTuple 2021-02-04 21:53:49 +01:00
Takeshi KOMIYA
421c6bb473 refactor: linkcheck: Skip queuing ignored URIs
To make checker-thread simpler, this checks the URI is ignored before
queueing.
2021-02-04 01:09:19 +09:00
Takeshi KOMIYA
88c6330900 linkcheck: The docname of hyperlink is not displayed (refs: #8791)
Currently, linkcheck displays the status of hyperlinks.  But it is hard
to search where the hyperlink is written because only line numbers are
shown as the location for the link.

This displays the docname of the link too.
2021-02-01 01:15:53 +09:00
Takeshi KOMIYA
434cc60ae5
Merge pull request #8794 from tk0miya/refactor_linkcheck3
refactor: linkcheck: Update type annotations
2021-01-31 23:45:59 +09:00
Takeshi KOMIYA
6701628e2e refactor: linkcheck: Update type annotations 2021-01-31 16:40:51 +09:00
Takeshi KOMIYA
d39fb5ce3a refactor: linkcheck: Access config object via self.config
Now builder objects have `config` attribute as a reference to the
living config object.  No reason to access it via `self.app.config`
longer!
2021-01-31 16:22:04 +09:00
François Freitag
227955cbe8
linkcheck: Raise on unknown status in process_result()
Helps catching programming errors. The else clause should never be
reached.
2021-01-27 17:36:10 +01:00
Takeshi KOMIYA
6c01d7614b
Merge branch '3.x' into rm-n 2021-01-24 22:43:33 +09:00
François Freitag
1121e5e8bc
Linkcheck: Derive number of links from the post-transform result
The number of links to check is the number of links in self.hyperlinks,
populated by the post-transform.
2021-01-24 12:24:52 +01:00
François Freitag
54df51e86f
Linkcheck: Don’t repeatedly open/close log files
Opening and closing a file requires processing from the operating
system. Repeatedly opening and closing wastes system resources and
hinders buffering, causing a flush (disk I/O) after each write
operation.

Using a context manager ensures the logs are flushed to disk and files
are properly closed whether the program exists successfully or an
exception occurs. Compared to the previous implementation, a brutal
shutdown of the machine (e.g. power cord disconnected) could cause some
log lines not to be written. That should not be an issue in practice.

Now, files are created and truncated when linkcheck submitted the links
to check to the threads and is ready to process the results, instead of
when the builder is constructed. It keeps the file operations closer to
their use.
2021-01-24 12:15:07 +01:00
Takeshi KOMIYA
2308695d24
Merge branch '3.x' into unused-attrs-linkcheck 2021-01-22 02:41:32 +09:00
Takeshi KOMIYA
a5b0d96c70
Merge branch '3.x' into typo 2021-01-22 01:15:53 +09:00
François Freitag
aa5e4e2da0 Deprecate linkcheck builder {broken,good,redirected}
These attributes were used to cache checked links and avoid issuing
another web request to the same URI.

Since 82ef497a8c, links are pre-processed
to ensure uniqueness. This caching the results of checked links is no
longer useful.
2021-01-21 17:06:51 +01:00
François Freitag
52fde7e7b1 Match linkcheck deprecation warning version with deprecated.rst
Deprecated.rst states the node_line_or_0 helper will be removed in
Sphinx 5.0, use a RemovedInSphinx50Warning.
2021-01-21 16:39:40 +01:00
Takeshi KOMIYA
bd103a82c9 refactor: linkcheck: Make linkcheck builder to a subclass of DummyBuilder
After recent refactoring, the linkcheck builder does not do "writing".
So it would be better to inherit the DummyBuilder.
2021-01-20 21:37:23 +09:00
Takeshi KOMIYA
cead0f6ddf linkcheck: Fix race condition that could lead to checking the availability of the same URL twice
So far, linkcheck scans all of references and images from documents, and
checks them parallel.  As a result, some URL would be checked twice (or
more) by race condition.

This collects the URL via post-transforms, and removes duplicated URLs
before checking availability.

refs: #4303
2021-01-20 20:58:27 +09:00
Takeshi KOMIYA
f996859420 A happy new year!
.. note::

   $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \;
   $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
2021-01-01 13:40:48 +09:00
François Freitag
a1b8b1febb
Ensure linkcheck items are comparable
Linkcheck organizes the URLs to checks in a PriorityQueue. The items are
tuples (priority, url, docname, lineno).

Tuples where the lineno is `None` are not comparable with tuples that
have an integer lineno, and PriorityQueue items must be comparable (see
https://bugs.python.org/issue31145).

Fixes an issue when a document contains two links to the same URL, one
with an int line number and the other without line number metadata (such
as an image :target: attribute).

Using 0 instead of None to represent no line number should not lead to
observable changes, the result logger only logs the line number when it
is truthy.

Close #8565
2020-12-22 21:18:31 +01:00
François Freitag
6b90a63f08 Fix #6629: linkcheck: Handle rate-limiting
Follow the Retry-After header if present, otherwise use an exponential
back-off.
2020-11-25 17:34:55 +01:00
Takeshi KOMIYA
67846b1e93 Merge branch '3.x' into 8131_too_many_redirects 2020-11-23 01:42:10 +09:00
François Freitag
683635f5b4 linkcheck: Remove call to is_ssl_error()
This method always returns False, it is dead code. The exception
checking stopped working because Requests library wraps SSL errors in a
`requests.exceptions.SSLError` and no longer throws an
`urllib3.exceptions.SSLError`. The first argument to that exception is
an `urllib3.exceptions.MaxRetryError`.
2020-11-12 19:58:04 +01:00
François Freitag
640cc40b7e
linkcheck: Set allow_redirects in requests.head() call
Following redirects is the default for other methods.
https://requests.readthedocs.io/en/latest/api/#requests.request

Define the option closer to its use.
2020-11-11 18:32:54 +01:00
François Freitag
0949735210
Sort imports with isort
Keep imports alphabetically sorted and their order homogeneous across
Python source files.

The isort project has more feature and is more active than the
flake8-import-order plugin.

Most issues caught were simply import ordering from the same module.
Where imports were purposefully placed out of order, tag with
isort:skip.
2020-11-11 13:19:05 +01:00
Takeshi KOMIYA
b415b25c09 Merge branch '3.2.x' into 3.x 2020-11-01 20:31:49 +09:00
Takeshi KOMIYA
eb3d9355f5
Merge pull request #8332 from sphinx-doc/8321_linkcheck_tel_links
Fix #8321: linkcheck: ``tel:`` schema hyperlinks are detected as errors
2020-10-25 18:48:50 +09:00
Takeshi KOMIYA
3171a44032 Fix #8321: linkcheck: `tel:` schema hyperlinks are detected as errors 2020-10-24 20:11:23 +09:00
Vasista Vovveti
72985c250b
Fix broken url not reporting error
Some links are printed as broken but do not error out the build.

This issue appeared when include `tel:` links in our build.
2020-10-20 12:43:10 -05:00
François Freitag
55f7919531
Linkcheck: Use Thread daemon argument
Instead of using a separate call.
2020-10-11 11:41:42 +02:00
Takeshi KOMIYA
837a4d1173
Merge pull request #8245 from mgeier/linkcheck-sourcedir
linkcheck: take source directory into account for local files
2020-10-04 17:17:33 +09:00
Matthias Geier
6b3d445879 Pass docname instead of srcdir 2020-10-04 10:02:57 +02:00
François Freitag
5ea8ee133d
Fix #8268: make linkcheck report HTTP errors 2020-10-03 14:33:29 +02:00
Matthias Geier
786972e47f linkcheck: take source directory into account for local files 2020-09-27 20:54:50 +02:00
Sebastien Besson
33732a3147 Extend linkchecker GET fallback logic to handle Too Many Redirects
Some websites will enter infinite redirect loops with HEAD requests. In this
case, the GET fallback is ignored as the exception is of type TooManyRedirects
and the link is reported as broken.
This extends the except clause to retry with a GET request for such scenarios.
2020-08-17 09:27:29 +01:00
Takeshi KOMIYA
875346307f linkcheck: Fix a protocol relative URL is considered as a local file
Since #7985, a protocol relative URL (URL starts with "//") is considered
as a local file incorrectly.  This makes it to a "unchecked" URL.

refs: #7985
2020-07-24 02:13:23 +09:00
Takeshi KOMIYA
f95ba21f4a Close #5208: linkcheck: Support checks for local links 2020-07-19 19:08:14 +09:00
Takeshi KOMIYA
a7725ad8ca Close #7247: linkcheck: Add linkcheck_request_headers 2020-06-01 01:48:46 +09:00
Wes Turner
fd94270f1c ENH: linkcheck: also write all links to output.json
* TST: linkcheck: make tests more flexible
* CLN: linkcheck: flake8, mypy
* REF: linkcheck: docpath->filename, write_jsonline->write_linkstat
* REF: linkcheck: remove redundant call to doc2path
* TST: linkcheck: show JSON obj structure in test
* REF: linkcheck: remove docname from JSON obj because it's redundant (use path2doc(filename) if necessary)
* TST: linkcheck: don't test row[info] output (see comments for examples)
2020-02-12 16:29:26 -05:00
Takeshi KOMIYA
041435024f Fix #7055: linkcheck: redirect is treated as an error 2020-01-30 23:08:00 +09:00
Takeshi KOMIYA
fc523c3ccf A happy new year! 2020-01-01 11:15:42 +09:00
Georg Brandl
3398194135 builders/linkcheck: include "experimental" HTTP 308 as "permanently"
Also remove redundant "default" case.
2019-11-30 17:07:25 +01:00
Jonas Haag
df2f80c755 Add linkcheck_auth option 2019-11-25 09:53:45 +01:00
Takeshi KOMIYA
d0fa844f91 Fix #6806: linkcheck: Failure on parsing content 2019-11-17 11:12:33 +09:00
Takeshi KOMIYA
32763520a3 Close #1331: Change default User-Agent header 2019-10-27 02:05:33 +09:00
Sebastien Besson
a2bc070533 Be defensive and handle newly defined HTTP error code
This commit implements a change to the linkcheck builder to handle undefined
HTTP error code such as https://tools.ietf.org/html/rfc7538.
At the moment, Sphinx will fail with an internal error. With this change,
a non-registered HTTP error code will be treated in the same way as error
code 0 i.e. unknown code.
2019-10-08 01:49:11 +09:00
Takeshi KOMIYA
9a085794a2 Migrate to py3 style type annotation: sphinx.builders.linkcheck 2019-06-10 23:17:51 +09:00
Takeshi KOMIYA
e731d746fd Fix #5502: linkcheck: Consider HTTP 503 response as not an error 2019-06-03 22:30:11 +09:00
Takeshi KOMIYA
690a566791 Fix #6378: linkcheck: Send commonly used User-Agent 2019-05-19 01:39:05 +09:00
Takeshi KOMIYA
dbefc9865d Clean up import for annotations 2019-03-06 23:44:44 +09:00
Takeshi KOMIYA
f551915e9f Close #5196: linkcheck also checks remote images exist 2019-02-06 00:21:52 +09:00
Takeshi KOMIYA
805861066f Add a helper function; get_node_line() 2019-02-06 00:04:51 +09:00
Takeshi KOMIYA
332f98d44c Give "nonl=True" value to logging.info() instead of int 2019-01-19 21:20:14 +09:00
Takeshi KOMIYA
76e9f57c2e Merge branch '1.8' 2019-01-02 16:16:25 +09:00
Takeshi KOMIYA
1b1ebd2c75 A happy new year! 2019-01-02 16:00:30 +09:00
Jon Dufresne
bade33c7e4 Remove unnecessary encoding cookie from Python source files
In Python 3, the default encoding of source files is utf-8. The encoding
cookie is now unnecessary and redundant so remove it. For more details,
see the docs:

https://docs.python.org/3/howto/unicode.html#the-string-type

> The default encoding for Python source code is UTF-8, so you can
> simply include a Unicode character in a string literal ...

Includes a fix for the flake8 header checks to stop expecting an
encoding cookie.
2018-12-16 12:22:12 -08:00
Jon Dufresne
ade973f4e3 Use Python 3 super() argument-less syntax
The form is less verbose and more idiomatic for Python 3 only code.

https://docs.python.org/3/library/functions.html#super
2018-12-15 08:35:55 -08:00
Takeshi KOMIYA
6bc357140d Replace all "unicode" type by "str" 2018-12-15 23:57:43 +09:00
Takeshi KOMIYA
53917f228f Move to py3 mode for mypy (and remove many "type: ignore" comments) 2018-12-15 02:42:42 +09:00
Takeshi KOMIYA
a4749ca468 Fix annotations for builders 2018-12-02 22:28:28 +09:00
Takeshi KOMIYA
8201687c5b Fix annotations for builders 2018-11-29 23:26:27 +09:00
Takeshi KOMIYA
3c99d00605 Add sphinx.util.typing:unicode to help mypy-3 migration 2018-11-24 23:19:51 +09:00
Takeshi KOMIYA
8f9a76f476 Remove use six.move module 2018-11-12 01:02:14 +09:00
Jon Dufresne
02fea029bf Prefer builtin open() over io.open() and codecs.open()
In Python3, the functions io.open() is an alias of the builtin open()
and codecs.open() is functionally equivalent. To reduce indirection,
number of imports, and number of patterns, always prefer the builtin.

https://docs.python.org/3/library/io.html#high-level-module-interface

> io.open()
>
> This is an alias for the builtin open() function.
2018-09-11 05:45:36 -07:00
Takeshi KOMIYA
dffc841d2c Merge branch 'master' into 5140_Accept_header_for_linkcheck 2018-07-29 18:52:43 +09:00
Takeshi KOMIYA
1302d785fb linkcheck: Drop application/xml from Accept header 2018-07-29 18:50:22 +09:00
Takeshi KOMIYA
3e57ea0a52 Merge branch '1.7' 2018-07-17 00:37:40 +09:00
Takeshi KOMIYA
2bdbe3aaf4 Fix flake8 violations 2018-07-16 21:03:32 +09:00
Honza Javorek
271e1d1340
make linter happy 2018-07-03 14:13:46 +02:00
Honza Javorek
6fe8835037
add default Accept header
There are situations where requested server replies with a different content (in my particular case HTTP 404) when there is no accept header, possibly because it evaluates the content negotiation to an API request instead of a browser request. This change adds a default Accept header, which equals to what my Firefox sets out of the box to its requests.

I stumbled upon this when checking a link to https://crates.io/crates/dredd-hooks. While

curl -i https://crates.io/crates/dredd-hooks

returns HTTP 404, following results in an expected HTTP 200 response with HTML body:

curl -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -i https://crates.io/crates/dredd-hooks
2018-07-03 14:00:33 +02:00
Takeshi KOMIYA
9efaf18852 Merge branch '1.7' 2018-03-18 01:21:01 +09:00
Takeshi KOMIYA
70a622b86c Revert "Use typing.TYPE_CHECKING for typehints"
This reverts commit a073e17537.
2018-03-13 23:23:15 +09:00
Takeshi KOMIYA
6faef28150 Make console and warning messages translatable 2018-03-03 23:18:38 +09:00
Takeshi KOMIYA
f8bb40ab30 Merge branch '1.7' 2018-02-18 12:39:07 +09:00
Takeshi KOMIYA
a073e17537 Use typing.TYPE_CHECKING for typehints 2018-02-14 22:57:38 +09:00
Takeshi KOMIYA
dc2b153835 Update type annotations 2018-02-04 15:14:51 +09:00
Takeshi KOMIYA
9f5c676322 Use flake8-import-order 2018-01-28 01:52:16 +09:00
Stephen Finucane
a83e8bab7d builders: Add 'Builder.epilog' option
This allows builders to emit a final epilog message containing
information such as where resulting files can be found. This is only
emitted if the build was successful.

This allows us to remove this content from the 'make_mode' tool and
the legacy 'Makefile' and 'make.bat' templates. There's room for more
dramatic simplification of the former, but this will come later.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2018-01-11 20:57:03 +00:00
Takeshi KOMIYA
2426cedb8b A happy new year! 2018-01-01 01:06:58 +09:00
Takeshi KOMIYA
579a79660e Update type annotations for new mypy 2017-05-07 14:28:41 +09:00
Takeshi KOMIYA
8f9dd64992 Merge branch 'stable' 2017-03-26 11:52:15 +09:00
Takeshi KOMIYA
c57e47e042 Year++ 2017-03-26 11:49:34 +09:00
Takeshi KOMIYA
aa6dfb8b41 Merge branch 'stable' 2017-03-18 18:25:50 +09:00
Takeshi KOMIYA
2dae11aa68 Fix #3552: linkcheck raises UnboundLocalError 2017-03-18 18:17:59 +09:00
Takeshi KOMIYA
554199d30e Upgrade to mypy-0.5 2017-03-03 23:17:34 +09:00
Takeshi KOMIYA
035ba39c2d Fix mypy violations 2017-01-22 00:46:49 +09:00
Takeshi KOMIYA
9ac221b140 Merge branch 'stable' 2017-01-20 12:17:38 +09:00
Takeshi KOMIYA
a0c2029b3c Fix #3295: Could not import extension sphinx.builders.linkcheck 2017-01-20 12:16:18 +09:00
Takeshi KOMIYA
38d6c34f35 Merge branch 'stable' 2017-01-12 13:03:53 +09:00
Takeshi KOMIYA
412bb9aae8 Fix flake8 violations 2017-01-12 10:09:44 +09:00
Takeshi KOMIYA
e755a8c004 Use loggers 2017-01-02 12:59:51 +09:00
Takeshi KOMIYA
b43523fcbe Use sphinx.util.logging instead app.info(), verbose(), debug() and debug2() 2017-01-02 12:59:50 +09:00
Takeshi KOMIYA
d5288567fd Update type annotations 2016-12-15 19:22:40 +09:00
Takeshi KOMIYA
e645ea59db Merge branch 'stable' 2016-12-14 00:12:23 +09:00
Takeshi KOMIYA
d72954d498 builtin extensions return metadata to allow parallel build 2016-12-12 21:22:16 +09:00
Takeshi KOMIYA
88887bad88 Update type annotation 2016-12-03 16:51:18 +09:00
Takeshi KOMIYA
e63afbc60e Merge branch '1.5-release' 2016-11-23 13:31:02 +09:00
Takeshi KOMIYA
8006d31b32 Fix #3095: Add tls_verify and tls_cacerts to support self-signed servers 2016-11-17 23:12:39 +09:00
Takeshi KOMIYA
23b1c3d5f2 Add type-check annotations to sphinx.builders 2016-11-16 12:06:22 +09:00
Darragh Bailey
22765990f0 Allow skipping anchor checking by regex
To avoid needing to turn off anchor checking across the entire
documentation allow skipping based on matching the anchor against a
regex.

Some sites/pages use JavaScript to perform anchor assignment in a
webpage, which would require rendering the page to determine whether
the anchor exists. Allow fine grain control of whether the anchor is
checked based on pattern matching, until such stage as the retrieved
URLs can be passed through an engine for deeper checking on the HTML
doctree.
2016-10-27 10:52:04 +01:00
Hiroaki Itoh
42604a1ff6 Fix #2990: linkcheck raises "Can't convert 'bytes' object to str implicitly" error if linkcheck_anchors enabled 2016-10-06 18:59:24 +09:00
Takeshi KOMIYA
4c7bec6460 Fix #3008: `linkcheck` builder ignores self-signed certificate URL 2016-10-06 12:46:23 +09:00
Takeshi KOMIYA
ce7fea9a35 Fix #2988: linkcheck: retry with GET request if denied HEAD request 2016-10-04 12:47:59 +09:00
Takeshi KOMIYA
07e30b279b Merge pull request #2884 from tk0miya/refactor_intersphinx
Refactor intersphinx: Use requests package
2016-08-27 16:43:54 +09:00
Takeshi KOMIYA
2b5c7057a7 Fix linkcheck builder does not send User-Agent header 2016-08-22 21:17:55 +09:00
Takeshi KOMIYA
fe1e5f7a7d linkcheck: Move requests package loader to sphinx.util.requests 2016-08-22 20:35:11 +09:00
Takeshi KOMIYA
54247c96fe Fix #2811: Show warning if requests < 2.4.1 2016-07-27 13:28:07 +09:00
Takeshi KOMIYA
8a45aa5e59 Now all builders and domains work as built-in extensions 2016-07-06 23:25:45 +09:00
Alex Gaynor
830e986b7a Include additional info on broken links in linkcheck 2016-05-29 10:30:33 -07:00
Darragh Bailey
2f46c7899c Some sites also return 403 on HEAD requests
Atlassian websites will return a 403 Forbidden access code when
queried, so add this to the list of codes that should trigger using a
GET request as a fallback.
2016-04-21 13:20:02 +01:00
Darragh Bailey
0b9ee8d451 Switch to using requests for better charset detection
Python requests does a better job of detecting the charsets of
webpages, performing automatic decoding when the text content is
requested, avoiding issues around needing to do detection.

This allows checking the following urls & anchors correctly:

    http://www.yaml.org/spec/1.2/spec.html#id2761803
    http://www.yaml.org/spec/1.2/spec.html#id2765878
    http://www.yaml.org/spec/1.2/spec.html#id2765878
2016-04-21 13:20:02 +01:00
Georg Brandl
fed5a34568 Merge pull request #2313 from alex/idiomatic
Make some code in linkcheck more idiomatic
2016-02-13 18:12:02 +01:00
Georg Brandl
222edf59e7 linkcheck: dont check anchors starting with "!".
Add changelog entry for #1099.
2016-02-13 16:06:55 +01:00
Alex Gaynor
3f2612ee78 Make some code in linkcheck more idiomatic 2016-02-13 09:54:51 -05:00
Alex Gaynor
e6980adaf6 oops, lost this 2016-02-13 09:02:44 -05:00
Alex Gaynor
863e2f468f moved more logic around 2016-02-13 08:55:55 -05:00
Alex Gaynor
ae5bfe500e syntax error 2016-02-13 08:55:00 -05:00
Alex Gaynor
4f00a9905c Fixed #1099 -- allow the linkcheck builder to retry on errors.
This is useful because if you run linkcheck often, you are likely to see lots of transient network errors, which usually disappear if you simply try again.
2016-02-13 08:52:38 -05:00
Georg Brandl
46d7e8558e Obligatory copyright update. 2016-01-14 22:54:04 +01:00
Takeshi KOMIYA
2bcf92dfb0 Fix #1815: linkcheck does not raise an exception if warniserror set to true and link is broken 2016-01-03 20:12:33 +09:00
Takeshi KOMIYA
8b57bc7227 Fix #2003: decode error under python2 (only) when `make linkcheck` is run 2015-12-21 22:34:04 +09:00
Takeshi KOMIYA
788c0ebffc Add testcase for encoding URIs in linkcheck builder 2015-12-19 22:49:14 +09:00
Barry Warsaw
5d30bc635b One way to work around the lack of html.parser.HTMLParserError in Python 3.5 2015-07-24 15:58:50 +02:00
Georg Brandl
ea97e6658c Linkcheck now works with non-ASCII URIs.
Fixes: #1739
2015-02-25 12:49:45 +01:00
Georg Brandl
2b6f7f4afe Closes #1687: for linkcheck purposes, HTTP 401 Unauthorized is working. 2015-01-19 19:50:31 +01:00
Georg Brandl
a23903d8d5 Merge branch 'stable' 2015-01-03 21:41:14 +01:00
Georg Brandl
567d52f199 all: update copyright 2015-01-03 21:36:32 +01:00
Takayuki Shimizukawa
74fbd611ab merge with stable 2014-06-09 22:45:05 +09:00
Takayuki Shimizukawa
82a53382d5 Fix: In python3 environment, make linkcheck cause "Can't convert 'bytes'
object to str implicitly" error when link target url has a hash part.
Thanks to Jorge_C. Closes #1457
2014-05-04 00:43:50 +09:00
Takayuki Shimizukawa
2d1549b35a wrap py3 iterators with list() for each places that expect a list object. refs #1350. 2014-04-30 23:25:44 +09:00
Takayuki Shimizukawa
f31d9113ff use six privided functions/classes to support py2/py3 in one source. refs #1350 2014-04-30 20:39:26 +09:00
Takayuki Shimizukawa
c3c879f2c6 use six privided functions/classes to support py2/py3 in one source. refs #1350. 2014-04-29 19:59:58 +09:00
Georg Brandl
ac92719ac3 Update copyright year. 2014-03-01 08:18:23 +01:00
Georg Brandl
e030031321 Update copyright year. 2014-03-01 08:18:16 +01:00
Dmitry Shachnev
ce2185ce27 Modernize the code now that Python 2.5 is no longer supported
- Use print function instead of print statement;
- Use new exception handling;
- Use in operator instead of has_key();
- Do not use tuple arguments in functions;
- Other miscellaneous improvements.

This is based on output of `futurize --stage1`, with some
manual corrections.
2014-01-19 14:17:10 +04:00
Takayuki Shimizukawa
cc7509966c merge heads 2014-01-15 05:25:56 +00:00
Georg Brandl
5406bff1cd Closes #1292: In the linkchecker, retry HEAD requests when denied by HTTP 405.
Also make the redirect code apparent and tweak the output a bit to be
more obvious.
2014-01-12 23:52:16 +01:00
Takayuki Shimizukawa
a8fc938d1b Drop python-2.5 and remove 2.4,2.5 support codes 2013-12-15 14:16:53 +09:00
Georg Brandl
151856819c Copyright update. 2013-01-01 22:13:15 +01:00
Jonathan Waltman
55b28b0198 Fix whitespace / line length issues reported by "make test" 2012-11-03 11:04:32 -05:00
Georg Brandl
166c7e8d27 Style fixes. 2012-03-10 18:13:55 +01:00
Marti Raudsepp
e0e9d2a7fa Add #anchor checking to 'linkcheck' builder.
This requires us to download the document and parse its HTML.
2012-02-28 20:12:59 +02:00