OpenVoiceOS / ovos-personal-backend

personal backend - self-hosted backend to manage multiple OVOS devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support ovos backend services

JarbasAl opened this issue · comments

for weather and wolfram alpha support should be added for ovos api - https://github.com/OpenVoiceOS/ovos_api_service

example weather integration

import requests
from ovos_utils import ovos_service_api


class OvosWeather:
    def __init__(self):
        self.api = ovos_service_api.OVOSApiService()
        self.api.register_device()

    def get_weather_onecall(self, query):
        self.api.get_session_challenge()
        headers = {'session_challenge': self.api.get_session_token(),  'backend': 'OWM'}
        reqdata = {"lat": query.get("lat"), 
                   "lon": query.get("lon"), 
                   "units": query.get("units"),
                   "lang": query.get("lang")}
        url = 'https://api.openvoiceos.com/weather/onecall_weather_report/' + self.api.get_uuid()
        r = requests.post(url, data=reqdata, headers=headers)
        return r.json()

this should also be made the default to ensure functionality is always available, users will still be able and encouraged to use their own keys