# Path: settings.py
# DEFAULT_USERNAME = "Username"
# 
# DEFAULT_PASSWORD = "Password"
# 
# Path: settings.py
# AUTHSERVER = _server_str % (PROTOCOL, HOSTNAME, AUTHSERVERPORT)
# 
# CHARSERVER = _server_str % (PROTOCOL, HOSTNAME, CHARSERVERPORT)
# 
# ZONESERVER = _server_str % (PROTOCOL, HOSTNAME, MASTERZONESERVERPORT)


import exceptions
import json
import pdb
import datetime
import requests
    import websocket
    import random
    import pprint
    import time
from time import sleep
from settings import *
from settings import DEFAULT_USERNAME, DEFAULT_PASSWORD
from settings import AUTHSERVER, CHARSERVER, ZONESERVER
    from random import randint
    if content != "pong":
        raise ConnectionError("Something went wrong." % content)
    else:
        return True

# Send username/password credentials to server
# Server sends back a cookie that we send with all our requests.
def login(username, password):
    data = {"username": username, "password": password}
    r = requests.post(''.join((AUTHSERVER, "/login")), data=data, cookies=COOKIES)
    content = json_or_exception(r)
    COOKIES.update(r.cookies)
    return content

# Ask authserver for list of characters associated with this account
# authserver returns a list of characters
def get_characters():
    r = requests.get(''.join((AUTHSERVER, "/characters")), cookies=COOKIES)
    content = json_or_exception(r)
    return content

# We could also query any details about the character like inventory 
#   or money or current stats at this point

# We pick a character we want to play and query the charserver for its current zone
# charserver returns the zone id, which uniquely identifies it persistently.
def get_zone(charname=None):
    if charname is None:
        charname = CURRENTCHAR


# Path: settings.py
# DEFAULT_USERNAME = "Username"
# 
# DEFAULT_PASSWORD = "Password"
# 
# Path: settings.py
# AUTHSERVER = _server_str % (PROTOCOL, HOSTNAME, AUTHSERVERPORT)
# 
# CHARSERVER = _server_str % (PROTOCOL, HOSTNAME, CHARSERVERPORT)
# 
# ZONESERVER = _server_str % (PROTOCOL, HOSTNAME, MASTERZONESERVERPORT)


# Path: idealclient.py
import exceptions
import json
import pdb
import datetime
import requests
    import websocket
    import random
    import pprint
    import time
from time import sleep
from settings import *
from settings import DEFAULT_USERNAME, DEFAULT_PASSWORD
from settings import AUTHSERVER, CHARSERVER, ZONESERVER
    from random import randint

    if content != "pong":
        raise ConnectionError("Something went wrong." % content)
    else:
        return True

# Send username/password credentials to server
# Server sends back a cookie that we send with all our requests.
def login(username, password):
    data = {"username": username, "password": password}
    r = requests.post(''.join((AUTHSERVER, "/login")), data=data, cookies=COOKIES)
    content = json_or_exception(r)
    COOKIES.update(r.cookies)
    return content

# Ask authserver for list of characters associated with this account
# authserver returns a list of characters
def get_characters():
    r = requests.get(''.join((AUTHSERVER, "/characters")), cookies=COOKIES)
    content = json_or_exception(r)
    return content

# We could also query any details about the character like inventory 
#   or money or current stats at this point

# We pick a character we want to play and query the charserver for its current zone
# charserver returns the zone id, which uniquely identifies it persistently.
def get_zone(charname=None):
    if charname is None:
        charname = CURRENTCHAR


    r = requests.get(''.join((CHARSERVER, '/', charname, '/zone')), )