__version__ = '0.1'
from enum import Enum
import sys
import os
import re
import time
import argparse
import urlparse
import getpass
import requests
from requests.exceptions import RequestException
import lxml.html


COUCHSURFING_NETLOC = 'www.couchsurfing.org'
COUCHSURFING_EVENT_BASE_PATH = '/n/events/'
COUCHSURFING_AUTH_BASE_PATH = '/n/auth'
DEFAULT_RETRY_DELAY = 30
MIN_RETRY_DELAY = 10

def write_error_and_exit(message):
    sys.stderr.write("{0}: error: {1}\n".format(
            os.path.basename(sys.argv[0]), 
            message)
                     )
    sys.exit(2)    

def validate_event_url(url):
    """