I am attempting to find the Image for an instance on Google Cloud Platform using the Google Python SDK. So far, I can get the instance, get the disks for the instance, find the boot disk, and extract the sourceImage and sourceImageId fields from there. However, since my instance and disk are in a different project from the image, I'm having trouble getting the actual image object.
The disk's sourceImage is https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20200420 and its sourceImageId is 2742482894347998968.
My question is similar to a previous question (GCP Python SDK - Get data from the googleapi url's) except that I would like to find the best-practice method. The lone answer on that question recommends using the URLs in the metadata to get the related object but there is a comment that indicates that the URLs in object metadata are not real URLs which makes me think they should not be used directly. All I need is the project (centos-cloud in this case) for the image and I can use the sourceImageId to get the image object. I could extract the project from the URL pretty easily but that seems fragile. I looked through the documentation to see if there was a built in function to extract the project or get the image using that URL, but I didn't find one.
Is there something I have overlooked? Or is this not a supported workflow? Or did I misinterpret John Hanley's comment and I should just use that URL to pull the image?
TL;DR: Given only a disk's sourceImage (eg. https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20200420) and sourceImageId (eg. 2742482894347998968), how can I programatically get the Image object from the API?
google-api-python-client==2.45.0
Python 3.10
Related
I am hoping to fetch images of locations using BirdsEye (BE) view through Bing Maps API (using Python 3.x). Unfortunately I was unable to find any relevant documentation for BE view on the BING API site. Also there is a conflicting information on whether BirdsEye is included in the latest version of the Maps API.
2 questions:
1) Does anyone know or can point to good examples of accessing BirdsEye view using Python through Bing Maps API?
2) Alternatively, could you let me know how I can amend the below code to access the required BE view pictures of the selected location (in this case Bellevue Washington):
url = "https://dev.virtualearth.net/REST/V1/Imagery/Map/BirdsEye/Bellevue%20Washington?&key=" + bingMapsKey
print(url)
filename = 'maps_default.png'
urllib.request.urlretrieve(url, filename)
I = misc.imread(filename)
plt.imshow(I)
plt.show()
I found a similar question asked in 2012 without any relevant answers, so hoping someone else can help.
The Bing Maps birds eye images are not available outside of the Bing Maps interactive map controls. The static REST API does not provide access to these images. You will see in the documentation that birdseye is not listed as an imagery type for this service: https://msdn.microsoft.com/en-us/library/ff701724.aspx
How to structure GET 'review link' request from Vimeo API?
New to python and assume others might benefit from my ignorance.
I'm simply trying to upload via the new vimeo api and return a 'review link'.
Are there current examples of the vimeo-api in python? I've read the documentation and can upload perfectly fine. However, when it comes to the http GET I can't seem to figure it out. Im using python2.7.5 and have tried requests library. Im ready to give up and just go back to PHP because its documented so much better.
Any python programmers out there familiar?
EDIT: Since this was written the vimeo.py library was rebuilt. This is now as simple as taking the API URI and requesting vc.get('/videos/105113459') and looking for the review link in the response.
The original:
If you know the API URL you want to retrieve this for, you can convert it into a vimeo.py call by replacing the slashes with dots. The issue with this is that in Python attributes (things separated by the dots), are syntax errors.
With our original rule, if you wanted to see /videos/105113459 in the python library you would do vc.videos.105113459() (if you had vc = vimeo.VimeoClient(<your token and app data>)).
To resolve this you can instead use python's getattr() built-in function to retrieve this. In the end you use getattr(vc.videos, '105113459')() and it will return the result of GET /videos/105113459.
I know it's a bit complicated, but rest assured there are improvements that we're working on to eliminate this common workaround.
I know Google's powerful image search feature but it's searching images from the entire Internet.. Until recently, I discovered they apply image search to Google+ photos. That means you can search your own photos by keywords.
I'm wondering if there's any API/Lib (provided by Google) so that I can use directly... To be more specific, I'm working on Google App Engine. I know there are Image API and Search API.. I have not found Image Search API yet. And I don't know if this deprecated image search API does the job I want..
I'm really trying my luck to ask this question!
I did lots of search for Google Image Search using local image but not found any accurate answer. like what are the parameter we have to pass when upload a photo to google server. so any one know how i can use Google Image search for searching local image stored in my harddisk but using python programming. tell me if any Library or API available. Thank you in advance.
This looks like a duplicate of this question:
Google Search by Image API?
The Google Image API is deprecated but as the answerer points out, there are alternatives like tinyeye.
I am trying to retrieve a photo (the .jpg file) from a Picasa album using the gdata Google API. However I did not find any method which does it, even though it is possible to upload a photo using methods like InsertPhoto and InsertPhotoSimple.
I guess I must be missing something :-(. A simple example would help.
Client API provides methods only for obtaining information on photos: http://code.google.com/apis/picasaweb/docs/1.0/developers_guide_python.html#Photos
To retrieve an image, use an HTTP GET with information previously obtained. Read the documentation.
For this purpose you may use a Python library:
httplib
urllib2