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’)