| 151 | |
| 152 | |
| 153 | class PrintOnlyHandler(BaseAuthorizationhandler): |
| 154 | def __init__(self, outfile=None): |
| 155 | self._outfile = outfile |
| 156 | |
| 157 | def __call__( |
| 158 | self, userCode, verificationUri, verificationUriComplete, **kwargs |
| 159 | ): |
| 160 | opening_msg = ( |
| 161 | f'Browser will not be automatically opened.\n' |
| 162 | f'Please visit the following URL:\n' |
| 163 | f'\n{verificationUri}\n' |
| 164 | ) |
| 165 | |
| 166 | user_code_msg = ( |
| 167 | f'\nThen enter the code:\n' |
| 168 | f'\n{userCode}\n' |
| 169 | f'\nAlternatively, you may visit the following URL which will ' |
| 170 | f'autofill the code upon loading:' |
| 171 | f'\n{verificationUriComplete}\n' |
| 172 | ) |
| 173 | |
| 174 | uni_print(opening_msg, self._outfile) |
| 175 | if userCode: |
| 176 | uni_print(user_code_msg, self._outfile) |
| 177 | |
| 178 | |
| 179 | class OpenBrowserHandler(BaseAuthorizationhandler): |
no outgoing calls