__init__.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> # 4 # Copyright 2012 Zearin <zearin@gonk.net> # 5 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # 6 # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> # 7 # Copyright 2016 Jannis Gebauer <ja.geb@me.com> # 8 # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> # 9 # Copyright 2017 sharkykh <sharkykh@gmail.com> # 10 # Copyright 2018 sfdye <tsfdye@gmail.com> # 11 # # 12 # This file is part of PyGithub. # 13 # http://pygithub.readthedocs.io/ # 14 # # 15 # PyGithub is free software: you can redistribute it and/or modify it under # 16 # the terms of the GNU Lesser General Public License as published by the Free # 17 # Software Foundation, either version 3 of the License, or (at your option) # 18 # any later version. # 19 # # 20 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # 21 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # 22 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 23 # details. # 24 # # 25 # You should have received a copy of the GNU Lesser General Public License # 26 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # 27 # # 28 ################################################################################ 29 30 """ 31 The primary class you will instantiate is :class:`github.MainClass.Github`. 32 From its ``get_``, ``create_`` methods, you will obtain instances of all Github objects 33 like :class:`github.NamedUser.NamedUser` or :class:`github.Repository.Repository`. 34 35 All classes inherit from :class:`github.GithubObject.GithubObject`. 36 """ 37 38 import logging 39 40 from . import Auth 41 from .AppAuthentication import AppAuthentication 42 from .GithubException import ( 43 BadAttributeException, 44 BadCredentialsException, 45 BadUserAgentException, 46 GithubException, 47 IncompletableObject, 48 RateLimitExceededException, 49 TwoFactorException, 50 UnknownObjectException, 51 ) 52 from .GithubIntegration import GithubIntegration 53 from .GithubRetry import GithubRetry 54 from .InputFileContent import InputFileContent 55 from .InputGitAuthor import InputGitAuthor 56 from .InputGitTreeElement import InputGitTreeElement 57 from .MainClass import Github 58 59 # set log level to INFO for github 60 logger = logging.getLogger("github") 61 logger.setLevel(logging.INFO) 62 logger.addHandler(logging.StreamHandler()) 63 64 65 def set_log_level(level: int) -> None: 66 """ 67 Set the log level of the github logger, e.g. set_log_level(logging.WARNING) 68 :param level: log level 69 """ 70 logger.setLevel(level) 71 72 73 def enable_console_debug_logging() -> None: # pragma no cover (Function useful only outside test environment) 74 """ 75 This function sets up a very simple logging configuration (log everything on standard output) that is useful for troubleshooting. 76 """ 77 set_log_level(logging.DEBUG) 78 79 80 __all__ = [ 81 "Auth", 82 "AppAuthentication", 83 "BadAttributeException", 84 "BadCredentialsException", 85 "BadUserAgentException", 86 "enable_console_debug_logging", 87 "Github", 88 "GithubException", 89 "GithubIntegration", 90 "GithubRetry", 91 "IncompletableObject", 92 "InputFileContent", 93 "InputGitAuthor", 94 "InputGitTreeElement", 95 "RateLimitExceededException", 96 "TwoFactorException", 97 "UnknownObjectException", 98 ]