New authentication cannot be performed on terminals with no tty
**Describe the bug**
When authenticating for the first time (or after removing a token) the user is presented with a url to visit via stdout, and a token is entered via stdin. In a session with no, or non default tty's, this means the user will not see the url, and may not be able to enter the token.

**To Reproduce**
Steps to reproduce the behavior:
1. Set up an environment with no standard tty. An example is timesketch api user [DFTimewolf](https://github.com/log2timeline/dftimewolf), which has recently implemented a curses UX. 
2. Remove your timesketch token from `~/.timesketch.token`
3. Run the tool

**Expected behavior**
The user should be notified that the session won't support providing a URL to visit, and cannot accept the required token

**Actual behavior**
The user is not aware they need to reauthenticate, as stdout is not available. A user cannot paste the authentication token into the terminal as stdin is not available. Instead, the application blocks on stdin with no indication of the problem.
diff --git a/api_client/python/timesketch_api_client/client.py b/api_client/python/timesketch_api_client/client.py
index 734229b6..77fe0e09 100644
--- a/api_client/python/timesketch_api_client/client.py
+++ b/api_client/python/timesketch_api_client/client.py
@@ -16,6 +16,7 @@ from __future__ import unicode_literals
 
 import os
 import logging
+import sys
 
 # pylint: disable=wrong-import-order
 import bs4
@@ -246,6 +247,11 @@ class TimesketchApi:
         if run_server:
             _ = flow.run_local_server()
         else:
+            if not sys.stdout.isatty() or not sys.stdin.isatty():
+                msg = ('You will be asked to paste a token into this session to'
+                    'authenticate, but the session doesn\\'t have a tty')
+                raise RuntimeError(msg)
+
             auth_url, _ = flow.authorization_url(prompt="select_account")
 
             if skip_open:
['api_client/python/timesketch_api_client/client.py']