Created
January 9, 2018 16:53
-
-
Save benstr/f908810f8396b7f657e6cfd2cbbca559 to your computer and use it in GitHub Desktop.
Example using base64 encoding to send a image over cellular on a Raspberry Pi with Hologram.io
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Hologram.HologramCloud import HologramCloud | |
import logging | |
import base64 | |
#uncomment if you want to see debugging messages. | |
#not suggested for larger images | |
#logging.basicConfig(level=logging.DEBUG, format="%(levelname)s: %(message)s") | |
hologram = HologramCloud(dict(), authentication_type='totp', network='cellular') | |
b64 = base64.b64encode(open("raspi-img.jpg", "rb").read()) | |
print len(b64) | |
hologram.network.connect() | |
send = hologram.sendMessage(b64, timeout=200) | |
print send | |
hologram.network.disconnect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment