Hi, I am trying to upload image, video via photoslibrary v1 API. But I am not getting how to upload? There are no demos and no clear documentation upon how to do it?
from googleapiclient.discovery import build
service = build('photoslibrary', 'v1', credentials=credentials)
It does not have API with for MediaFileUpload https://developers.google.com/api-client-library/python/guide/media_upload
I do using requests.
import requests
headers = {
'Content-Type': "application/octet-stream",
'X-Goog-Upload-File-Name': "line-586.jpg",
'X-Goog-Upload-Protocol': "raw",
'Authorization': "Bearer " + creds.access_token,
}
data = open('image.jpg', 'rb').read()
response = requests.post('https://photoslibrary.googleapis.com/v1/uploads', headers=headers, data=data)
image_token = response.text
still cannot figure out is there a way to do it via service
@CircleOnCircles I figured out the same way. It would have been better if this api would also have something like https://developers.google.com/api-client-library/python/guide/media_upload
Hello! The photos API is maintained separately. Here is their support page. The Photos API has Java and PHP client libraries, but not one for Python. You can interact with the Photos REST API via requests in Python.
If a Python client library is of interest, it may be worth putting in a feature request. There is more information on how to do that on the support page.
@CircleOnCircles I figured out the same way. It would have been better if this api would also have something like developers.google.com/api-client-library/python/guide/media_upload
Totally agree! the same here. I also tried.
@busunkim96 google-api-python-client could be used to call the photo api.
for example,
from googleapiclient.discovery import build
service = build('photoslibrary', 'v1', credentials=credentials)
response_create_album = service.albums().create(body={'album':{'title':'helloworld'}}).execute()
Media Uploading become the only request which cannot be used via the library. thus, it becomes very counter-intuitive.
@CircleOnCircles It may be possible to get parts of the library to work with our client, but they unfortunately aren't designed to be completely compatible. Sorry for any confusion this may have caused!
The full list of APIs that can be accessed with google-api-python-client is here.
@busunkim96 Can we work on a PR to get support for Photos API?
Unfortunately that's unlikely -- the Photos API is maintained separately, and this library is in maintenance mode (We will address critical bugs but won't add new features).
If a Python client library for the Photos API is of interest, I would strongly recommend filing a feature request on the Photos Library issue tracker and the Photos team will address it.
Okay, thank you!
On Wed, May 1, 2019 at 9:40 PM Bu Sun Kim notifications@github.com wrote:
Unfortunately that's unlikely -- the Photos API is maintained separately,
and this library is in maintenance mode (We will address critical bugs but
won't add new features).If a Python client library for the Photos API is of interest, I would
strongly recommend filing a feature request on the Photos Library issue
tracker https://b.corp.google.com/savedsearches/5157556 and the Photos
team will address it.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/googleapis/google-api-python-client/issues/651#issuecomment-488327682,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADHZBZN5LEPMKW76PHZVUZ3PTG6F5ANCNFSM4HIBUB7Q
.
I have created a feature request.
Most helpful comment
I do using
requests.