Http get request and return status

Welcome! This is the right Category if you have support questions about the operation or creation of Skills. When requesting support, please be sure to provide;

  • The specific Skill name and GitHub repository
  • Which Device (ie. Picroft, Mark I, Linux) you are using
  • What you’ve already tried to do to resolve the error.

Logs are also helpful.
Find more information on Mycroft logs at:

Help is also available in Chat at Mycroft Chat

I am attempting to create a skill that checks to make sure a site is up. So I would like to just have the skill do a http get request to a site and speak back to me the status. So a 200 success or a 404 not found, something like that. I have worked with python before but I am just having a hard time integrating it into a skill.

I am not using a skill from a GitHub I went through the mycroft-msk create process. So I have a skill that listens for a phrase and speaks a phrase back. So I assumed I could just add a request to that skill but I am struggling with that part. Anywhere I attempt to put a get request in that skill it breaks. I have imported requests so I know that’s not it. Any help would be great. Thank you!

Hi, how is the skill breaking? and can you show the code you have?

when i say it breaks i mean my mycroft stops understanding my intent phrase. so for example i would say the phrase “is the site up” and for now i just have it answer “yes”. but when i have tried to add the http get request and i say “is the site up” i will get a response of “i dont understand”, or “you may have to say that a different way” so its like it does not recognize that the phrase is part of the skill anymore.

Here is the code after the mycroft-msk create:

from mycroft import MycroftSkill, intent_file_handler

class CheckWebsite(MycroftSkill):
def init(self):
MycroftSkill.init(self)

@intent_file_handler('check.website.intent')
def handle_check_website(self, message):
    self.speak_dialog('check.website')

def create_skill():
return CheckWebsite()

i have tried adding a http get request like this:

from mycroft import MycroftSkill, intent_file_handler
import requests

class CheckWebsite(MycroftSkill):
def init(self):
MycroftSkill.init(self)

@intent_file_handler('check.website.intent')
def handle_check_website(self, message):
    **r = requests.get('http://blanchard04.ddns.net')**
    self.speak_dialog('check.website')

def create_skill():
return CheckWebsite()

after adding that in mycroft stops understanding when i say the phrase. i did forget to mention i am doing this on a linux pc

Since the formatting is a bit mangled It’s a bit hard to determine much.

A general tip is to check the skills.log in /var/log/mycroft/ It should tell you exactly what is failing when the skill is loaded or you can launch the mycroft cli and then in your editor save the file to trigger a skill reload. This will also show any issues during startup of the skill.

thank you @forslund for the help. you got me going down the right path. looking at the logs it was a problem with indents and spacing. when i was adding the http get request i was using tab to indent when i should have used spaces. i used spaces and now it is working the way i expected. i was trying to figure this out for a few days and it always seems to be something simple. Thank you for the help and getting me going in the right direction

1 Like

Glad you got it going!