Clean up
This commit is contained in:
parent
2a9cd03c47
commit
8c34a450c1
6 changed files with 17 additions and 33 deletions
3
test.py
3
test.py
|
|
@ -20,7 +20,8 @@ logger.setLevel(logging.DEBUG)
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
async def main():
|
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()
|
||||||
print(" DISCONNECTING TWICE AT THE SAME TIME")
|
print(" DISCONNECTING TWICE AT THE SAME TIME")
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
|
from typing import List, Optional
|
||||||
|
|
||||||
from .message import Message
|
from .message import Message
|
||||||
from .room import Room
|
from .room import Room
|
||||||
from .user import User
|
from .user import User
|
||||||
|
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
__all__ = ["Client"]
|
__all__ = ["Client"]
|
||||||
|
|
||||||
class Client:
|
class Client:
|
||||||
|
|
@ -12,8 +12,8 @@ class Client:
|
||||||
|
|
||||||
async def join(self,
|
async def join(self,
|
||||||
room_name: str,
|
room_name: str,
|
||||||
password: str = None,
|
password: Optional[str] = None,
|
||||||
nick: str = None) -> Room:
|
nick: str = "") -> Room:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def get(self, room_name: str) -> Optional[Room]:
|
async def get(self, room_name: str) -> Optional[Room]:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"EuphException",
|
"EuphException",
|
||||||
# Connection stuff
|
# Connection exceptions
|
||||||
"IncorrectStateException",
|
"IncorrectStateException",
|
||||||
"ConnectionClosedException",
|
"ConnectionClosedException",
|
||||||
# Joining a room
|
# Joining a room
|
||||||
|
|
@ -9,16 +9,12 @@ __all__ = [
|
||||||
"CouldNotAuthenticateException",
|
"CouldNotAuthenticateException",
|
||||||
# Doing stuff in a room
|
# Doing stuff in a room
|
||||||
"RoomClosedException",
|
"RoomClosedException",
|
||||||
# Other stuff
|
|
||||||
"RateLimitException",
|
|
||||||
"NotLoggedInException",
|
|
||||||
"UnauthorizedException",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
class EuphException(Exception):
|
class EuphException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Connection stuff
|
# Connection exceptions
|
||||||
|
|
||||||
class IncorrectStateException(EuphException):
|
class IncorrectStateException(EuphException):
|
||||||
"""
|
"""
|
||||||
|
|
@ -64,16 +60,3 @@ class RoomClosedException(EuphException):
|
||||||
completed.
|
completed.
|
||||||
"""
|
"""
|
||||||
pass
|
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
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from .user import User, LiveUser
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Optional
|
|
||||||
import datetime
|
import datetime
|
||||||
|
from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
|
from .user import LiveUser, User
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .client import Client
|
from .client import Client
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
|
from typing import List, Optional
|
||||||
|
|
||||||
from .exceptions import *
|
from .exceptions import *
|
||||||
from .message import LiveMessage
|
from .message import LiveMessage
|
||||||
from .user import LiveUser
|
from .user import LiveUser
|
||||||
|
|
||||||
from typing import List, Optional
|
|
||||||
|
|
||||||
__all__ = ["Room"]
|
__all__ = ["Room"]
|
||||||
|
|
||||||
class Room:
|
class Room:
|
||||||
|
|
@ -65,8 +65,8 @@ class Room:
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
room_name: str,
|
room_name: str,
|
||||||
nick: str = None,
|
nick: str = "",
|
||||||
password: str = None):
|
password: Optional[str] = None) -> None:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.closed = False
|
self.closed = False
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from .util import mention, atmention
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from .util import atmention, mention
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .client import Client
|
from .client import Client
|
||||||
from .room import Room
|
from .room import Room
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue