Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
github.com/gphotosuploader/google-photos-api-client-go/v2
This package provides a client for using the Google Photos API in go. Uses the original photoslibrary
package, that was provided by Google and now it's maintained here.
The package offers access to these Google Photos services:
CachedAlbumsService
is a service to manage albums.MediaItemsService
is a service to manage media items (Photos and Videos).Uploader
is a service to upload items.This project will maintain compatibility with the last three Go major versions published.
$ go get github.com/gphotosuploader/google-photos-api-client-go/v2
The package could be consumed using three different services in isolation or a gphotos.Client
. It implements Google Photos error handling best practices. It uses an exponential backoff policy with a maximum of 5 retries.
albums.WithCache()
option. See documentation./v1/uploads
endpoint.
BasicUploader
is a simple HTTP uploader.ResumableUploader
is an uploader implementing resumable uploads. It could be used for large files, like videos. See documentation.The gphotos library does not directly handle authentication. Instead, when creating a new client, pass an http.Client
that can handle authentication for you. The easiest and recommended way to do this is using the golang.org/x/oauth2
library, but you can always use any other library that provides an http.Client
.
Access to the API requires OAuth client credentials from a Google developers project. This project must have the Library API enabled as described here.
import (
"golang.org/x/oauth2"
gphotos "github.com/gphotosuploader/google-photos-api-client-go/v2"
)
func main() {
ctx := context.Background()
oc := oauth2Config := oauth2.Config{
ClientID: "... your application Client ID ...",
ClientSecret: "... your application Client Secret ...",
// ...
}
tc := oc.Client(ctx, "... your user Oauth Token ...")
client := gphotos.NewClient(tc)
}
Note that when using an authenticated Client, all calls made by the client will include the specified OAuth token. Therefore, authenticated clients should almost never be shared between different users. See the oAuth2 docs for complete instructions on using that library.
Only images and videos can be uploaded. If you attempt to upload non videos or images or formats that Google Photos doesn't understand, Google Photos will give an error when creating media item.
All media items uploaded to Google Photos using the API are stored in full resolution at original quality. They count toward the user’s storage. The API does not offer a way to upload in "high quality" mode.
If you upload the same image (with the same binary data) twice then Google Photos will deduplicate it. However it will retain the filename from the first upload which may be confusing. In practise this shouldn't cause too many problems.
Note that you can only add media items that have been uploaded by this application to albums that this application has created, see here why.
Google Photos imposes a rate limit on all API clients. The quota limit for requests to the Library API is 10,000 requests per project per day. The quota limit for requests to access media bytes (by loading a photo or video from a base URL) is 75,000 requests per project per day.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.