GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( fb7819...8bfa1a )
by thatsIch
01:13
created

_is_online()   A

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
"""
2
This module handles every related to online checking.
3
4
We need to request several information from various providers.
5
We could just try to request them, but instead
6
you can ping them first and check if they are even reachable.
7
This does not mean, that do not need to handle a failure on their part
8
(e.g. if the server is responding, but can't deliver the information).
9
"""
10
11
12
import http.client
0 ignored issues
show
Bug introduced by
The name client does not seem to exist in module http.
Loading history...
13
14
15
def _is_online(domain, sub_path, response_status, response_reason):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
16
    conn = http.client.HTTPSConnection(domain, timeout=1)
0 ignored issues
show
Bug introduced by
The Module http does not seem to have a member named client.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
17
    conn.request("HEAD", sub_path)
18
    response = conn.getresponse()
19
    conn.close()
20
21
    return (response.status == response_status) and (response.reason == response_reason)
22
23
24
def is_rm_doc_online():
25
    """
26
    Check if the Rainmeter documentation page is online.
27
28
    The Rainmeter online documentation is required to synchronize the local model
29
    with the latest online version. These information are stored and parsed
30
    to display them as a tooltip on special constructs.
31
    """
32
    return _is_online("docs.rainmeter.net", "/manual-beta/", 200, "OK")
33
34
35
def is_gh_online():
36
    """
37
    Check if GitHub is online.
38
39
    The different services of GitHub are running in seperat services
40
    and thus just being GitHub online does not mean,
41
    that required parts are online.
42
    """
43
    return _is_online("github.com", "/", 200, "OK")
44
45
46
def is_gh_raw_online():
47
    """
48
    Check if the raw content delivery from Github is online.
49
50
    It is routed to 301 and Moved Permanently because per standard it is routed to github.com
51
    because it natively only accepts real content paths.
52
53
    We do not follow reroutes else it would be 200 OK on github.com but we already have another method to check for that
54
    and Github.com is on a different service than the content delivery.
55
    """
56
    return _is_online("raw.githubusercontent.com", "/", 301, "Moved Permanently")
57