from slackbot.bot import respond_to
from slackbot.bot import listen_to
import re
import urllib

from slackbot.bot import respond_to
from slackbot.bot import listen_to
import re
import urllib


def url_validator(url):
    try:
        code = urllib.urlopen(url).getcode()
        if code == 200:
            return True
    except:
        return False


def test_url(message, url):
    if url_validator(url[1:len(url)-1]):
        message.reply('VALID URL')
    else:
        message.reply('NOT VALID URL')

Add url_validator function and respond aciton to test url
Add url_validator function and respond aciton to test url

  from slackbot.bot import respond_to
  from slackbot.bot import listen_to
  import re
  import urllib
  
+ 
+ def url_validator(url):
+     try:
+         code = urllib.urlopen(url).getcode()
+         if code == 200:
+             return True
+     except:
+         return False
+ 
+ 
+ def test_url(message, url):
+     if url_validator(url[1:len(url)-1]):
+         message.reply('VALID URL')
+     else:
+         message.reply('NOT VALID URL')
+ 
Add url_validator function and respond aciton to test url
## Code Before:
from slackbot.bot import respond_to
from slackbot.bot import listen_to
import re
import urllib

## Instruction:
Add url_validator function and respond aciton to test url
## Code After:
from slackbot.bot import respond_to
from slackbot.bot import listen_to
import re
import urllib


def url_validator(url):
    try:
        code = urllib.urlopen(url).getcode()
        if code == 200:
            return True
    except:
        return False


def test_url(message, url):
    if url_validator(url[1:len(url)-1]):
        message.reply('VALID URL')
    else:
        message.reply('NOT VALID URL')
