https://amp.cards/theguardian/us/amazing_article
workboxSW.router.registerNavigationRoute('index.html')
https://amp.cards/theguardian/us/another_article
from apiclient import discovery from httplib2 import Http from oauth2client.service_account import ServiceAccountCredentials SCOPES = 'https://www.googleapis.com/auth/chat.bot' creds = ServiceAccountCredentials.from_json_keyfile_name( 'svc_acct.json', SCOPES) CHAT = discovery.build('chat', 'v1', http=creds.authorize(Http())) room = 'spaces/<ROOM-or-DM>' message = {'text': 'Hello world!'} CHAT.spaces().messages().create(parent=room, body=message).execute()
import requests import json URL = 'https://chat.googleapis.com/...&thread_key=T12345' message = {'text': 'Hello world!'} requests.post(URL, data = json.dumps(message))
curl
curl \ -X POST \ -H 'Content-Type: application/json' \ 'https://chat.googleapis.com/...&thread_key=T12345' \ -d '{"text": "Hello!"}'
implementation 'com.google.android.things:cloud-iot-core:1.0.0'
var configuration = IotCoreConfiguration.Builder(). .setProjectId("my-gcp-project") .setRegistry("my-device-registry", "us-central1") .setDeviceId("my-device-id") .setKeyPair(keyPairObject) .build() var iotCoreClient = IotCoreClient.Builder() .setIotCoreConfiguration(configuration) .setOnConfigurationListener(onConfigurationListener) .setConnectionCallback(connectionCallback) .build() iotCoreClient.connect()
private fun publishTelemetry(temperature: Float, humidity: Float) { // payload is an arbitrary, application-specific array of bytes val examplePayload = """{ |"temperature" : $temperature, |"humidity": $humidity |}""".trimMargin().toByteArray() val event = TelemetryEvent(examplePayload, topicSubpath, TelemetryEvent.QOS_AT_LEAST_ONCE) iotCoreClient.publishTelemetry(event) } private fun publishDeviceState(telemetryFrequency: Int, enabledSensors: Array<String>) { // payload is an arbitrary, application-specific array of bytes val examplePayload = """{ |"telemetryFrequency": $telemetryFrequency, |"enabledSensors": ${enabledSensors.contentToString()} |}""".trimMargin().toByteArray() iotCoreClient.publishDeviceState(examplePayload) }