|
4 | 4 | # This file is execfile()d with the current directory set to its containing dir. |
5 | 5 | from __future__ import annotations |
6 | 6 |
|
| 7 | +import os |
7 | 8 | import sys |
8 | 9 | from pathlib import Path |
9 | 10 |
|
|
86 | 87 | # sourceforge.net is giving a 403 error, but is still accessible from the browser. |
87 | 88 | # Links to release notes in jira give 401 error: unauthorized. PYTHON-5585 |
88 | 89 | linkcheck_ignore = [ |
89 | | - "https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-monitoring.md#requesting-an-immediate-check", |
90 | | - "https://github.com/mongodb/specifications/blob/master/source/transactions-convenient-api/transactions-convenient-api.md#handling-errors-inside-the-callback", |
91 | | - "https://github.com/mongodb/specifications/blob/master/source/uri-options/uri-options.md", |
92 | | - "https://github.com/mongodb/specifications/blob/master/source/uri-options/uri-options.md", |
93 | | - "https://github.com/mongodb/libmongocrypt/blob/master/bindings/python/README.rst#installing-from-source", |
94 | 90 | r"https://wiki.centos.org/[\w/]*", |
95 | 91 | r"https://sourceforge.net/", |
96 | 92 | r"https://jira\.mongodb\.org/secure/ReleaseNote\.jspa.*", |
97 | 93 | ] |
98 | 94 |
|
99 | 95 | # Allow for flaky links. |
100 | 96 | linkcheck_retries = 3 |
| 97 | +# Serialize requests to dochub.mongodb.org to avoid rate-limiting (PYTHON-5847). |
| 98 | +linkcheck_workers = 1 |
| 99 | +# Give slow redirects more time before retrying. |
| 100 | +linkcheck_timeout = 60 |
| 101 | + |
| 102 | +# Ignore anchors in links since they may not be added to the page right away. |
| 103 | +linkcheck_anchors_ignore_for_url = [r"https://github.com/.*"] |
| 104 | + |
| 105 | +# Pass GitHub token to avoid rate-limiting on GitHub links. |
| 106 | +if github_token := os.environ.get("GITHUB_TOKEN"): |
| 107 | + linkcheck_request_headers = { |
| 108 | + "https://github.com/": {"Authorization": f"token {github_token}"}, |
| 109 | + "https://api.github.com/": {"Authorization": f"token {github_token}"}, |
| 110 | + } |
| 111 | + |
101 | 112 |
|
102 | 113 | # -- Options for extensions ---------------------------------------------------- |
103 | 114 | autoclass_content = "init" |
|
0 commit comments