Why call of Google Slides API returns error? - python-3.x

I have essentially been using this code to load an image into Google Drive and then transferring that image over to Google Slides using Python and for some reason it stopped working today.
The code I based mine off of is located here:
http://wescpy.blogspot.com/2016/11/using-google-slides-api-with-python.html
However, today I reran it and am getting an error:
googleapiclient.errors.HttpError: https://slides.googleapis.com/v1/presentations/PRESENTATION_ID returned "Invalid requests[0].createImage: Access to the provided image was forbidden.">
I am wondering if anything have changed in Google API?

Are you getting the same error today 2020/3/6?
<HttpError 400 when requesting https://slides.googleapis.com/v1/presentations/6-7HI:batchUpdate?fields=&alt=json returned "Invalid requests[24].createImage: Access to the provided image was forbidden.">
The error happens every time I am trying to push any image stored in Google Slides using either createImage or replaceAllShapesWithImage.
Note that the URLs pointing at Google Drive content are related to Public content. Thus, the workaround above mentioned by #miladio is not useful at this time.

I ran into the same issue. You should check out this link, which describes changes to the Drive API: Upcoming changes to the Google Drive API and Google Picker API
The proposed solution here seems feasible, although I have not fully tested it myself: Google script replaceAllShapesWithImage with image from drive doesn"t work any more

Related

Facebook Graph API v10 image upload to Pages feed

I'm trying to upload a image to facebook via graph api v10.
i have followed the docs: https://developers.facebook.com/docs/graph-api/resumable-upload-api/
I'm getting the File-Handle as result, but i dont know how to append this File-handle to my Page post. Does anyone know what i can do with this File-Handle to attach it to a Post I'm automatically posting after the file upload was successful?
Thanks!
I´ve got the same problem. In the Facebook Graph API Documentation it says:
When we're done with uploading the data, you'll get a file handle:
{"h":"2:c2FtcGxlLm1wNA==:image/jpeg:GKAj0gAUCZmJ1voFADip2iIAAAAAbugbAAAA:e:1472075513:ARZ_3ybzrQqEaluMUdI"}
This value can be used in place of an uploaded file for subsequent
graph calls.
However, no examples or further explanations are provided on how to use the received file handler.

Google Maps static image api used in dialogflow basic card gives problem, what to do?

I have in a basic card an image with a Google Maps Static Image Api url (shortened via Firebase Dynamic Links Shorten Api, which produces links like this https://example.page.link/UVWXYZuvwxyz12345).
This used to worked without any problems, but since a few months/weeks this does not work on the Google Assistant at least on smart phones anymore, I only get a grey rectangle instead.
It works however in the Action on Google Emulator without any problems. The link shortening is not the problem because when I shorten a link to an arbitrary image on the internet the image is displayed without problems.
The image is 192px high as required in the docs.
Has anybody got this working in the last weeks? Any idea what changed?
Here is an example of such an unshortened google maps static image api url (please replace the YYY at the end with your own google maps key):
https://maps.googleapis.com/maps/api/staticmap?size=330x192&markers=color:0xa10068%7Clabel:1%7C52.417908,9.6392955&markers=color:0x005eb8%7Clabel:3%7C52.42109,9.72186&markers=color:0x005eb8%7Clabel:5%7C52.4058059,9.7129063&markers=color:0x005eb8%7Clabel:7%7C52.42667,9.71606&markers=color:0x005eb8%7Clabel:8%7C52.32266,9.82017&markers=color:0x005eb8%7Clabel:9%7C52.3977616,9.7691778&path=color:green%7C52.417908,9.6392955%7C52.417908,9.6392955%7C52.42109,9.72186&path=color:green%7C52.4058059,9.7129063%7C52.42667,9.71606&path=color:green%7C52.32266,9.82017%7C52.3977616,9.7691778&path=color:green&maptype=roadmap&style=saturation:-30%7Clightness:30&style=feature:poi%7Cvisibility:off&style=feature:transit.station%7Cvisibility:off&key=YYY

Image inaccessible from python script but accessible in browser

I was trying to automatically download some traffic camera photos to play around with some image object recognition scripts and I have found that some links to them will throw a 403: Forbidden error when I try to download them from Python, and yet I can access them in a browser. One such image is at this link: https://www.svz-bw.de/kamera/ftpdata/KA101/KA101_gross.jpg
This code:
urllib.request.urlretrieve("https://www.svz-bw.de/kamera/ftpdata/KA101/KA101_gross.jpg", "traffic.jpg")
Returns a 403 error for me. What gives? I can understand that perhaps these organizations are not keen on having people bog down their servers with automatic downloads and perhaps there are some GDPR-related constraints, but I am actually more curious about how they are able to detect that the request is coming from a script and not from normal use

Python: adding comments to specific cell using Drive API

I am trying to automate some simple updating of a Google spreadsheet and I'm using the gspread library to do so. One task that is critical and not currently supported by gspread is the ability to add comments to a specific cell (there's an open issue for this and even a gist solution but I was getting a 404 error when trying to use it).
I know that the Google Drive API (v3) supports adding comments as described here, but I'm having issues with authenticating and could use some help.
What I have/know:
I have already setup the OAuth 2.0 and registered for the API through Google, as well as have the client_secret.json in my directory, but my knowledge of web requests and responses is limited so going through the Drive API documentation hardly makes sense. I know in order to create the comments I will have to make use of anchors and specify the cell location using column/row numbers.
What I'm stuck on:
When using the Google API Explorer, I'm getting a 400 error with the message: The 'fields' parameter is required for this method. How can I make the POST request using my authentication? I think from there I'd be able to actually add the comments myself.
I'm getting a 400 error with the message: The 'fields' parameter is required for this method
The error is asking for a property which you want returned (these properties are listed in Drive API files resource).
You can just place ' * ' to indicate you want it to return a complete response. That's the quick fix.

Retrieve BLOGS_UPLOADED_IMAGES in java

I have some java code that retrieves blogs through the REST API's. I am not using the social business toolkit, but we have our own framework for that.
The application works perfectly on an on-premise connections environment and has worked on multiple versions.
However when switching to Connections Cloud, some parts stopped worked.
We get a 403 - Forbidden exception on 2 occasions:
Getting the details of a blog post: /blogs/[blog-id]/feed/entry/atom?entryid=[entry-id]
Getting images inside the blog post: /blogs/[blog-id]/resource/BLOGS_UPLOADED_IMAGES/[image file name]
I have fixed issue 1) by switching to the plublishing API: /blogs/[blog-id]/api/entries/[entry-id].
I cannot find a way to fix issue 2). I have also found 2 other image urls:
https://apps.ce.collabserv.com/blogs/[blog-id]/api/media/[file-name]
https://apps.ce.collabserv.com/blogs/[blog-id]/api/media/BLOGS_UPLOADED_IMAGES/[file-name].media
Both return:
<sp_0:error xmlns="http://incubator.apache.org/abdera" xmlns:sp_0="http://incubator.apache.org/abdera">
<code>404</code>
<message>Not Found</message>
</sp_0:error>
I want to authenticate by using Basic Authentication when possible. This does not appear to work with the given 403 urls.
My guess is that this the basic authentication header is not picked up. I have seen this before.
I used to fix this by first calling another URL that does support basic authentication and using the Ltpa cookies to authenticate the image url.
This also does not work: I do get LtpaTokens, but when I pass all the cookies to the URL, the image still does not work.
I prefer not to use OAuth of OAuth 2 at this moment. Is there any other way to fix this?
Anybody else managed to retrieve BLOGS_UPLOADED_IMAGES?
The issue is can also be reproduced in a browser.
Make sure you are not yet authenticated and the blog has posts with
images
Go to /blogs/[blog-id]/api/media
Authenticate using the popup in the browser The Atom feed now appears. This contains the images of your blog.
403 when opening:
/blogs/[blog-id]/resource/BLOGS_UPLOADED_IMAGES/[image]
404 xml when opening: /blogs/[blog-id]/api/media/* links

Resources