Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
beucismis committed Apr 14, 2024
1 parent b353664 commit b0ec7e6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/limoon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from limoon.core import *
from limoon.model import *
from limoon.constant import BASE_URL


__all__ = (
Expand All @@ -15,5 +16,6 @@
Entry,
Rank,
Topic,
BASE_URL,
)
__version__ = "0.0.4"
__version__ = "0.0.5"
36 changes: 29 additions & 7 deletions src/limoon/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ def get_topic(topic_keywords: TopicKeywords, max_entry: int = None) -> model.Top

h1 = r.html.find("h1#title", first=True)
path = h1.find("a", first=True).attrs["href"]
page_count = r.html.find("div.pager", first=True).attrs["data-pagecount"]
page_count = r.html.find("div.pager", first=True)

return model.Topic(
int(h1.attrs["data-id"]),
h1.attrs["data-title"],
path[1:],
utils.entry_parser(r.html, max_entry),
int(page_count),
int(page_count.attrs["data-pagecount"]) if page_count else page_count,
)


Expand Down Expand Up @@ -107,13 +107,35 @@ def get_author(nickname: Nickname) -> model.Author:
)


def get_author_rank():
pass
def get_author_rank(nickname: Nickname) -> model.Rank:
"""This function get Ekşi Sözlük author rank.
Arguments:
nickname (str): Unique author nickname.
Returns:
model.Rank (class): Rank data class.
"""

author = get_author(nickname)

return model.Rank(name=author.rank.name, karma=author.rank.karma)


def get_author_topic():
pass
def get_author_topic(nickname: Nickname, max_entry: int = None) -> model.Topic:
"""This function get Ekşi Sözlük author topic.
Arguments:
nickname (str): Unique author nickname.
max_entry (int=None): Maximum number of entrys to be get from page.
Returns:
model.Topic (class): Topic data class.
"""

r = request(constant.AUTHOR_TOPIC_ROUTE.format(nickname))

return get_topic(urlparse(r.url).path[1:], max_entry=max_entry)

def get_agenda(max_topic: int = None, max_entry: int = None) -> Iterator[model.Topic]:
"""This function get Ekşi Sözlük agenda (gündem) page.
Expand Down Expand Up @@ -164,4 +186,4 @@ def get_debe(max_entry: int = None) -> Iterator[model.Entry]:


def search_topic(search_keywords: SearchKeywords):
pass
raise NotImplementedError
4 changes: 2 additions & 2 deletions src/limoon/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ class Topic:
title (str): Topic title.
path (str): Unique topic path.
entrys (class): Entrys written for topic.
page_count (int): Topic total page count.
page_count (int|None): Topic total page count.
url (str): Topic HTTP link.
"""

id: int
title: str
path: str
entrys: Iterator[Entry]
page_count: int
page_count: Union[int, None]
url: URL = field(init=False)

def __repr__(self):
Expand Down

0 comments on commit b0ec7e6

Please sign in to comment.