当前位置: 首页>>代码示例>>Golang>>正文


Golang importer.Host类代码示例

本文整理汇总了Golang中camlistore/org/pkg/importer.Host的典型用法代码示例。如果您正苦于以下问题:Golang Host类的具体用法?Golang Host怎么用?Golang Host使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Host类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: AccountSetupHTML

func (imp) AccountSetupHTML(host *importer.Host) string {
	base := host.ImporterBaseURL() + "flickr"
	return fmt.Sprintf(`
<h1>Configuring Flickr</h1>
<p>Visit <a href='http://www.flickr.com/services/apps/create/noncommercial/'>http://www.flickr.com/services/apps/create/noncommercial/</a>, fill out whatever's needed, and click on SUBMIT.</p>
<p>From your newly created app's main page, go to "Edit the authentication flow", use the following settings:</p>
<ul>
  <li>App Type: Web Application</li>
  <li>Callback URL: <b>%s</b></li>
</ul>
<p> and SAVE CHANGES </p>
<p>Then go to "View the API Key for this app", and copy the "Key" and "Secret" into the "Client ID" and "Client Secret" boxes above.</p>
`, base+"/callback")
}
开发者ID:sfrdmn,项目名称:camlistore,代码行数:14,代码来源:flickr.go

示例2: AccountSetupHTML

func (im *imp) AccountSetupHTML(host *importer.Host) string {
	base := host.ImporterBaseURL() + "foursquare"
	return fmt.Sprintf(`
<h1>Configuring Foursquare</h1>
<p>Visit <a href='https://foursquare.com/developers/apps'>https://foursquare.com/developers/apps</a> and click "Create a new app".</p>
<p>Use the following settings:</p>
<ul>
  <li>Download / welcome page url: <b>%s</b></li>
  <li>Your privacy policy url: <b>%s</b></li>
  <li>Redirect URI(s): <b>%s</b></li>
</ul>
<p>Click "SAVE CHANGES".  Copy the "Client ID" and "Client Secret" into the boxes above.</p>
`, base, base+"/privacy", base+"/callback")
}
开发者ID:peterwatts,项目名称:camlistore,代码行数:14,代码来源:foursquare.go

示例3: AccountSetupHTML

func (im *imp) AccountSetupHTML(host *importer.Host) string {
	base := host.ImporterBaseURL() + "twitter"
	return fmt.Sprintf(`
<h1>Configuring Twitter</h1>
<p>Visit <a href='https://apps.twitter.com/'>https://apps.twitter.com/</a> and click "Create New App".</p>
<p>Use the following settings:</p>
<ul>
  <li>Name: Does not matter. (camlistore-importer).</li>
  <li>Description: Does not matter. (imports twitter data into camlistore).</li>
  <li>Website: <b>%s</b></li>
  <li>Callback URL: <b>%s</b></li>
</ul>
<p>Click "Create your Twitter application".You should be redirected to the Application Management page of your newly created application.
</br>Go to the API Keys tab. Copy the "API key" and "API secret" into the "Client ID" and "Client Secret" boxes above.</p>
`, base, base+"/callback")
}
开发者ID:kristofer,项目名称:camlistore,代码行数:16,代码来源:twitter.go

示例4: Run

func (im *imp) Run(h *importer.Host, intr importer.Interrupt) error {
	if im.authToken == "" {
		return fmt.Errorf("miniToken config key required. Go to %s to get one.", authURL)
	}

	resp := searchPhotosResult{}
	if err := im.flickrRequest(h.HTTPClient(), map[string]string{
		"method":  "flickr.photos.search",
		"user_id": "me",
		"extras":  "description, date_upload, date_taken, original_format, last_update, geo, tags, machine_tags, views, media, url_o"},
		&resp); err != nil {
		return err
	}

	for _, item := range resp.Photos.Photo {
		camliIdFramgment := fmt.Sprintf("photo-%s", item.Id)
		photoContentHint := item.Lastupdate
		fmt.Println(camliIdFramgment, photoContentHint)
		// TODO(aa): Stuff
	}

	return nil
}
开发者ID:jakubbrzeski,项目名称:camlistore,代码行数:23,代码来源:flickr.go

示例5: AccountSetupHTML

func (imp) AccountSetupHTML(host *importer.Host) string {
	// Picasa doesn't allow a path in the origin. Remove it.
	origin := host.ImporterBaseURL()
	if u, err := url.Parse(origin); err == nil {
		u.Path = ""
		origin = u.String()
	}

	callback := host.ImporterBaseURL() + "picasa/callback"
	return fmt.Sprintf(`
<h1>Configuring Picasa</h1>
<p>Visit <a href='https://console.developers.google.com/'>https://console.developers.google.com/</a>
and click <b>"Create Project"</b>.</p>
<p>Then under "APIs & Auth" in the left sidebar, click on "Credentials", then click the button <b>"Create new Client ID"</b>.</p>
<p>Use the following settings:</p>
<ul>
  <li>Web application</li>
  <li>Authorized JavaScript origins: <b>%s</b></li>
  <li>Authorized Redirect URI: <b>%s</b></li>
</ul>
<p>Click "Create Client ID".  Copy the "Client ID" and "Client Secret" into the boxes above.</p>
`, origin, callback)
}
开发者ID:pombredanne,项目名称:camlistore,代码行数:23,代码来源:picasa.go


注:本文中的camlistore/org/pkg/importer.Host类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。