Merge pull request #267 from willhite/picasa-help

Add steps for getting Google oauth credentials to usage message.
This commit is contained in:
Dan Willhite
2015-09-10 11:01:14 -07:00

View File

@@ -10,6 +10,7 @@ import (
"math/rand"
"net"
"net/http"
"os"
"strings"
"time"
@@ -23,8 +24,8 @@ import (
)
var (
apiKeyFlag = flag.String("api-key", "", "API keys for Google can be created at https://console.developers.google.com")
apiKeySecretFlag = flag.String("api-key-secret", "", "API keys for Google can be created at https://console.developers.google.com")
apiKeyFlag = flag.String("api-key", "", "API key from Google credentials. See below for help creating credentials:")
apiKeySecretFlag = flag.String("api-key-secret", "", "API secret from Google credentials. See below for help creating credentials")
albumIdFlag = flag.String("album-id", "", "Import a specific album, identified by id")
ds *dataset.Dataset
httpClient *http.Client
@@ -58,7 +59,29 @@ type OauthToken struct {
RefreshToken string
}
func picasaUsage() {
credentialSteps := `How to create Google API credentials:
1) Go to http://console.developers.google.com/start
2) From the "Select a project" pull down menu, choose "Create a project..."
3) Fill in the "Project name" field (e.g. Picasa Importer)
4) Agree to the terms and conditions and hit continue.
5) Click on the "Select a project" pull down menu and choose "Manage all projects..."
6) Click on the project you just created. On the new page, in the sidebar menu,
click “APIs and auth”. In the submenu that opens up, click "Credentials".
7) In the popup, click on the "Add credentials" pulldown and select "OAuth 2.0 client ID".
8) Click the "Configure consent screen" button and fill in the "Product name" field.
All other fields on this page are optional. Now click the save button.
9) Select "Other" from the list of “Application Type” and fill in the “Name” field
(e.g. Picasa Importer) and click the “Create” button.
Your credentials will be displayed in a popup. Copy them to a safe place.`
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
flag.PrintDefaults()
fmt.Fprintf(os.Stderr, "\n%s\n\n", credentialSteps)
}
func main() {
flag.Usage = picasaUsage
dsFlags := dataset.NewFlags()
flag.Parse()
httpClient = util.CachingHttpClient()