大佬教程收集整理的这篇文章主要介绍了Google Place Photos API 返回空数据 - Golang,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试通过其他 API 端点提供的 Google photo_reference
ID 请求获取照片。但是,它返回一个没有图像的对象。我已经设置了一个小型 API 网络服务器来接受以下负载:
# POST
{
"photo_reference": "photo-reference-ID","key": "my-Google-API-key"
}
我处理调用的函数:
import (
"context"
"fmt"
"Googlemaps.github.io/maps"
"image"
"log"
)
type Photorequest struct {
PhotoReference String `Json:"photo_reference"`
Key String `Json:"key"`
}
func Photo(p *Photorequest) (maps.PlacePhotoResponse,error) {
c,err := maps.NewClIEnt(maps.WithAPIKey(p.Key))
if err != nil {
log.Panicf("Fatal error: %s",err)
}
r := &maps.PlacePhotorequest{
PhotoReference: p.photoReference,MaxHeight: 600,MaxWIDth: 600,}
result,err := c.PlacePhoto(context.BACkground(),r)
if err != nil {
log.Panicf("Fatal error: %s",err)
}
fmt.Println(result)
return result,nil
}
回复:
{
"data": { "ContentType": "image/jpeg","Data": {} }
}
注意显示:处理请求的 http 路由。我已经检查了请求,所有数据都是正确的。
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的Google Place Photos API 返回空数据 - Golang全部内容,希望文章能够帮你解决Google Place Photos API 返回空数据 - Golang所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。