Skip to main content

About

The purpose of GooBook is to make it possible to use your Google Contacts from the command-line and from MUAs such as Mutt. It can be used from Mutt the same way as abook.

Installation Instructions

pipx

This is the recommended way to install goobook for most users that don’t have it available in their distribution. You may first need to install pipx itself, which should be available in your distribution. If not, you can install it with pip; see: https://pypi.org/project/pipx/

Install goobook like this:

$ pipx install goobook

This will install goobook as ~/.local/bin/goobook (In a UNIX environment).

Configuration

First you need to authenticate yourself:

run:

$ goobook authenticate -- client_secrets.json

and follow the instructions, this part is web based.

In case you’ve already been using goobook and have authenticated with Google in the past there is no need to re-authenticate again.

If the procedure above to get client secrets stops working this is an alternative way to do it:

  • Go to the Google developer console https://console.developers.google.com/

  • Create a new project (drop down at the top of the screen) (you are free to use an existing one if you so prefer)

  • Select the newly created project

  • Go to OAuth consent screen from sidebar

  • Select the interal user type if you can but most will only be able to select external.

  • On next screen give it a name (ex. GooBook)

  • select Add scope, click manually paste and write “https://www.googleapis.com/auth/contacts” inte the lower text box.

  • and hit hit add and then save

  • Go to Credentials from sidebar

  • Click Create Credentials from top, then OAuth Client ID in the dropdown

  • Choose Desktop app, enter any name you want, and hit create

  • click “Download JSON” and save the file to be used below

To authenticate with Google you need a web browser installed. You will be directed to Google and finally to http://localhost:8080. Make sure, no other service is bound to port tcp/8080 - otherwise the authentication will fail. Make also sure, no local firewall prevents local access to port 8080.

If you do not have a browser installed locally and do not want to install one, you can perform the authentication on another system on which goobook and a browser are installed. You will need the client_secrets.json file and by performing the authentication create an oauth token file, which you must transfer back to your original system. To easily find the oauth token file, create a configuration file in which you enter the location and name of the file by:

oauth_db_filename: ~/.goobook_auth.json

See details about the configuration file in the next section.

This configuration file gets included in the authenticate run like this:

$ goobook ~/.config/goobookrc authenticate -- client_secrets.json

To get access too more settings you can create a configuration file:

goobook config-template > ~/.config/goobookrc

It will look like this:

# Use this template to create your ~/.goobookrc

# "#" or ";" at the start of a line makes it a comment.

[DEFAULT]
# The following are optional, defaults are shown when not other specified.

# This file is written by the oauth library, and should be kept secure,
# it's like a password to your google contacts.
# default is to place it in the XDG_DATA_HOME
;oauth_db_filename: ~/.goobook_auth.json

;cache_filename: ~/.goobook_cache   # default is in the XDG_CACHE_HOME
;cache_expiry_hours: 24
;filter_groupless_contacts: yes

# New contacts will be added to this group in addition to "My Contacts"
# Note that the group has to already exist on google or an error will occur.
# One use for this is to add new contacts to an "Unsorted" group, which can
# be sorted easier than all of "My Contacts".
;default_group:

Files

GooBook is using three files, the optional config file that can be placed in the XDG_CONFIG_HOME (~/.config/goobookrc) or in the home directory (~/.goobookrc).

The authentication file that is created by running goobook authenticate in XDG_DATA_HOME (~/.local/share/goobook_auth.json) but can also be placed in the home directory (~/.goobook_auth.json).

The contacts cache file that is created in XDG_CACHE_HOME (~/.cache/goobook_cache) but can also be placed in the home directory (~/.goobook_cache).

Proxy settings

If you use a proxy you need to set the https_proxy environment variable.

Mutt

If you want to use goobook from mutt, set in your .muttrc file:

set query_command="goobook query %s"

to query address book. (Normally bound to “Q” key.)

If you want to be able to use <tab> to complete email addresses instead of Ctrl-t add this:

bind editor <Tab> complete-query

To add email addresses (with “a” key normally bound to create-alias command):

macro index,pager a "<pipe-message>goobook add<return>" "add the sender address to Google contacts"

If you want to add an email’s sender to Contacts, press a while it’s selected in the index or pager.

Usage

To query your contacts:

$ goobook query QUERY

The add command reads a email from STDIN and adds the From address to your Google contacts:

$ goobook add

The cache is updated automatically according to the configuration but you can also force an update:

$ goobook reload

For more commands see:

$ goobook -h

and:

$ goobook COMMAND -h

Release files for goobook 3.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for goobook 3.5.4
File Size Uploaded
goobook-3.5.4.tar.gz 34.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for goobook 3.5.4
File Interpreter ABI Platform
goobook-3.5.4-py3-none-any.whl Python 3 none any Details

Total release size: 71.8 kB

Release files / goobook-3.5.4.tar.gz

Download URL goobook-3.5.4.tar.gz
Size 34.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6a847234bc558e13c08648e0612f339e3500353284efb22f28b90714ec01e905
BLAKE2b-256 checksum
How to use checksums
bdb16e905f9f2955d714c6ab79e327fd92952b15534e670fbb9ef8fa5a83b51b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.25.9 CPython/3.12.3 Linux/6.14.0-29-generic

Release files / goobook-3.5.4-py3-none-any.whl

Download URL goobook-3.5.4-py3-none-any.whl
Size 37.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
843dbf15173a0fd37205e9e03c5ac69d00d1bbf287a31d0901f76f6db126f298
BLAKE2b-256 checksum
How to use checksums
3f072fbc54d78df2d6954afa91f9e4f619e9cb66600674447d1c2a2c9a50b05e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.25.9 CPython/3.12.3 Linux/6.14.0-29-generic
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page