Send files to google storage

Hello,

I´m doing a project that I need send photo to google storage or google drive. I choose google storage, because code is much easier than the other one. The problem is, I need a google library that I install in my computer, but my OpenCam can´t find.

I was proving a lot of things but I can´t find the wat. Thank you very much

The code is the next one:

import network, usocket

import ujson as json

import gc

import urequests

from machine import UART

import time

from pyb import UART

import sensor, image

import uos

from google.cloud import storage

import os

SSID=‘******’

KEY=‘******’

sensor.reset()

sensor.set_pixformat(sensor.RGB565)

sensor.set_framesize(sensor.QVGA)

sensor.skip_frames(time = 2000)

Connect to WiFi

print(“Connecting to WiFi…”)

wlan = network.WINC()

wlan.connect(SSID, key=KEY)

while not wlan.isconnected():

pass

print(“WiFi Connected!”)

print(wlan.ifconfig())

Capture an image

print(“Capturing image…”)

img = sensor.snapshot()

os.environ[“GOOGLE_APPLICATION_CREDENTIALS”] = ‘your_credentials’

client = storage.Client()

bucket = client.get_bucket(‘your_bucket_name’) #Here goes the bucket name

blob = bucket.blob(‘img’) #The name of the image
blob.upload_from_filename(‘img’)

Hi, the python code running on the OpenMV Cam runs on the device itself. Not on your PC. So, you can’t just use desktop libraries with it.

We have a ureqests module that lets you do REST API calls. You should use this to interface with whatever the REST API for the cloud storage is.

Hi, that make sense, but I can´t find the way to do REST API calls. I can´t find it in documentation. Could you help me?

https://docs.openmv.io/library/urequests.html