g

command module
v0.0.0-...-496fb36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

g: The Google Assistant command

Run queries against Google Assistant on every shell 🎉

This is one of my weekend-research projects. It uses the official Google Assistant Embedded gRPC API and its Go Bindings

Note: the software might break and there is no guarantee it will even work, because the APIs its based on are still in alpha. Use with caution

With some little changes to the code-base, you will also be able to output HTML:

Ps. The code is not intended for the commercial use.

Installation

  • Press on "New project" and select your Google Cloud Project (or make a new one) and commit with "Create project"

  • Scroll down and press on "Device registration"

  • Then, press on "REGISTER MODEL"

  • Enter the required info and press "REGISTER MODEL"

  • Press on "Download OAuth 2.0 credentials"

  • You can skip the device traits part
  • Make sure you have Python installed
  • Install the google-auth-oauthlib tool pip install --upgrade "google-auth-oauthlib[tool]"
  • Run the tool
google-oauthlib-tool --client-secrets <PATH TO YOUR OAUTH2 CREDENTIALS> \
                     --credentials credentials.json \
                     --scope https://www.googleapis.com/auth/assistant-sdk-prototype \
                     --save
  • Sign in with Google and grant the rights, and you should see the file credentials.json where you ran the command
  • Download g for your OS from the Releases Page
  • Create a new file, called config.yaml and populate it with the contents of your device & oauth credentials:
oauth: # OAuth Configuration
  client_id: <CLIENT_ID> # OAuth Client ID
  client_secret: <CLIENT_SECRET> # OAuth Client Secret
  scopes: # OAuth scopes
    - https://www.googleapis.com/auth/assistant-sdk-prototype
  auth_url: https://accounts.google.com/o/oauth2/auth # OAuth Auth URL
  token_url: https://accounts.google.com/o/oauth2/token # OAuth Token URL
  refresh_token: <REFRESH_TOKEN> # OAuth Refresh Token
device: # Device Configuration
  endpoint: embeddedassistant.googleapis.com:443 # Service Endpoint
  device_id: default # Device ID
  device_model_id: default # Device Model ID
  language_code: en-US # Language Code
  • Run the g <query> command
  • Profit

Development

  • Get Go
  • Build with the build.sh script

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL