This file contains 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
package main | |
import ( | |
"encoding/json" | |
"io/ioutil" | |
"net/http" | |
"time" | |
"github.com/labstack/echo/v4" | |
"github.com/labstack/echo/v4/middleware" |
This file contains 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
def speech_to_text_microphone(recognizer, microphone): | |
if not isinstance(recognizer, speech_recognition.Recognizer): | |
raise TypeError("`recognizer` must be `Recognizer` instance") | |
if not isinstance(microphone, speech_recognition.Microphone): | |
raise TypeError("`microphone` must be `Microphone` instance") | |
print("Say something!") | |
with microphone as source: |
This file contains 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
def get_weather_info(location): | |
try: | |
response = requests.get("http://api.weatherstack.com/current?access_key=ebd06089ca30cb46428616818d96d6ca&query="+location) | |
# If the response was successful, no Exception will be raised | |
result = response.json() | |
if 'success' in result and result['success'] == False: | |
raise TypeError("`Location not valid") | |
return result | |
except HTTPError as http_err: |