Skip to content

Commit

Permalink
set session
Browse files Browse the repository at this point in the history
  • Loading branch information
barrust committed Jan 10, 2024
1 parent 1ef724c commit cc7d867
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 4 additions & 5 deletions mediawiki/configuraton.py
Expand Up @@ -109,15 +109,14 @@ def lang(self) -> str:
@lang.setter
def lang(self, language: str):
"""Set the language to use; attempts to change the API URL"""
t_lang = language.lower()
if self._lang == t_lang:
if self._lang == language.lower():
return
url = self._api_url
tmp = url.replace(f"/{self._lang}.", f"/{t_lang}.")
tmp = url.replace(f"/{self._lang}.", f"/{language.lower()}.")

self.api_url = tmp
self._lang = t_lang
self._clear_memoized - True
self._lang = language.lower()
self._clear_memoized = True

@property
def api_url(self) -> str:
Expand Down
5 changes: 3 additions & 2 deletions mediawiki/mediawiki.py
Expand Up @@ -106,6 +106,8 @@ def __init__(
# for memoized results
self._cache: Dict = {}

self._reset_session()

# for login information
self._is_logged_in = False
if self._config.username is not None and self._config.password is not None:
Expand Down Expand Up @@ -236,7 +238,6 @@ def language(self) -> str:
@language.setter
def language(self, lang: str):
"""Set the language to use; attempts to change the API URL"""
print(f"language setter: {lang}")
self._config.lang = lang
if self._config._clear_memoized:
self.clear_memoized()
Expand Down Expand Up @@ -855,7 +856,7 @@ def _get_site_info(self):
"""Parse out the Wikimedia site information including API Version and Extensions"""

response = self.wiki_request({"meta": "siteinfo", "siprop": "extensions|general"})
print(response)

# parse what we need out here!
query = response.get("query", None)
if query is None or query.get("general", None) is None:
Expand Down

0 comments on commit cc7d867

Please sign in to comment.