code: def get_travis_token(*, GitHub_token=None, **login_kwargs):
      
      _headers = {
          'Content-Type': 'application/json',
          'User-Agent': 'MyClient/1.0.0',
      }
      headersv2 = {**_headers, **Travis_APIv2}
      token_id = None
      try:
          if not GitHub_token:
              print(green("I need to generate a temporary token with GitHub to authenticate with Travis. You may get a warning email from GitHub about this."))
              print(green("It will be deleted immediately. If you still see it after this at https://github.com/settings/tokens after please delete it manually."))
              # /auth/github doesn't seem to exist in the Travis API v3.
              tok_dict = generate_GitHub_token(scopes=["read:org", "user:email", "repo"],
                                               note="temporary token for doctr to auth against travis (delete me)",
                                               **login_kwargs)
              GitHub_token = tok_dict['token']
              token_id = tok_dict['id']
  
          data = {'github_token': GitHub_token}
          res = requests.post('https://api.travis-ci.com/auth/github', data=json.dumps(data), headers=headersv2)
          return res.json()['access_token']
      finally:
          if token_id:
              delete_GitHub_token(token_id, **login_kwargs)
docs: Generate a temporary token for authenticating with Travis
  
      The GitHub token can be passed in to the ``GitHub_token`` keyword
      argument. If no token is passed in, a GitHub token is generated
      temporarily, and then immediately deleted.
  
      This is needed to activate a private repo
  
      Returns the secret token. It should be added to the headers like
  
          headers['Authorization'] = "token {}".format(token)