Skip to content

Commit

Permalink
Use GET on wikipedia fn
Browse files Browse the repository at this point in the history
  • Loading branch information
Chlorophytus committed May 31, 2024
1 parent 2b31dd1 commit fb2b24d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion chloresolve/chloresolve/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.0+rev31"
__version__ = "0.2.0+rev32"
18 changes: 8 additions & 10 deletions chloresolve/chloresolve/mediawiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,20 @@ def __init__(self, endpoint: str):
"""
self.endpoint: str = endpoint

def query(self, what: str) -> str:
def query(self, title: str) -> str:
"""
Queries the endpoint API and then returns a future description result.
The HTML will be stripped.
"""
# Query your wiki's JSON description
r: requests.Response = requests.post(self.endpoint, json={
"action": "query",
"format": "json",
"prop": "description",
"titles": what,
"redirects": 1,
"ascii": 1,
"formatversion": "2"
})
r: requests.Response = requests.get("https://en.wikipedia.org/w/api.php", params={
'action': 'query',
'format': 'json',
'prop': 'description',
'titles': title,
'redirects': 1,
'formatversion': 2})

# Get the result
result = r.json()
Expand Down

0 comments on commit fb2b24d

Please sign in to comment.