This commit is contained in:
Joscha 2019-04-07 19:03:22 +00:00
parent 2a9cd03c47
commit 8c34a450c1
6 changed files with 17 additions and 33 deletions

View file

@ -20,7 +20,8 @@ logger.setLevel(logging.DEBUG)
logger.addHandler(handler)
async def main():
conn = Connection("wss://echo.websocket.org")
conn = Connection("wss://euphoria.io/room/test/ws")
#conn = Connection("wss://euphoria.io/room/cabal/ws") # password protected
print()
print(" DISCONNECTING TWICE AT THE SAME TIME")

View file

@ -1,9 +1,9 @@
from typing import List, Optional
from .message import Message
from .room import Room
from .user import User
from typing import List, Optional
__all__ = ["Client"]
class Client:
@ -12,8 +12,8 @@ class Client:
async def join(self,
room_name: str,
password: str = None,
nick: str = None) -> Room:
password: Optional[str] = None,
nick: str = "") -> Room:
pass
async def get(self, room_name: str) -> Optional[Room]:

View file

@ -1,6 +1,6 @@
__all__ = [
"EuphException",
# Connection stuff
# Connection exceptions
"IncorrectStateException",
"ConnectionClosedException",
# Joining a room
@ -9,16 +9,12 @@ __all__ = [
"CouldNotAuthenticateException",
# Doing stuff in a room
"RoomClosedException",
# Other stuff
"RateLimitException",
"NotLoggedInException",
"UnauthorizedException",
]
class EuphException(Exception):
pass
# Connection stuff
# Connection exceptions
class IncorrectStateException(EuphException):
"""
@ -64,16 +60,3 @@ class RoomClosedException(EuphException):
completed.
"""
pass
# exception for having no username?
# Maybe these will become real exceptions one day?
class RateLimitException(EuphException):
pass
class NotLoggedInException(EuphException):
pass
class UnauthorizedException(EuphException):
pass

View file

@ -1,7 +1,7 @@
from .user import User, LiveUser
from typing import TYPE_CHECKING, Optional
import datetime
from typing import TYPE_CHECKING, Optional
from .user import LiveUser, User
if TYPE_CHECKING:
from .client import Client

View file

@ -1,9 +1,9 @@
from typing import List, Optional
from .exceptions import *
from .message import LiveMessage
from .user import LiveUser
from typing import List, Optional
__all__ = ["Room"]
class Room:
@ -65,8 +65,8 @@ class Room:
def __init__(self,
room_name: str,
nick: str = None,
password: str = None):
nick: str = "",
password: Optional[str] = None) -> None:
pass
self.closed = False

View file

@ -1,7 +1,7 @@
from .util import mention, atmention
from typing import TYPE_CHECKING
from .util import atmention, mention
if TYPE_CHECKING:
from .client import Client
from .room import Room