Skip to content

Commit 629ad02

Browse files
wolfram_tools moved to a separate module
1 parent 92125ab commit 629ad02

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

wolfram_tools/__init__.py

Whitespace-only changes.

math_bot/wolfram.py renamed to wolfram_tools/requests.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1+
from collections import OrderedDict
2+
13
import requests
4+
25
from xmltodict import parse
3-
from collections import OrderedDict
46

5-
from config import Config
7+
8+
def make_wolfram_request(query, app_id):
9+
params = {
10+
'input': query,
11+
'appid': app_id
12+
}
13+
answer = requests.get(
14+
url='http://api.wolframalpha.com/v2/query',
15+
params=params
16+
)
17+
return WolframResult(parse(answer.content))
618

719

820
class WolframResult(OrderedDict):
@@ -43,15 +55,3 @@ class WolframImage(OrderedDict):
4355
def __init__(self, parsed_img: OrderedDict):
4456
super().__init__(parsed_img)
4557
self.src = parsed_img['@src']
46-
47-
48-
def make_wolfram_query(query):
49-
params = {
50-
'input': query,
51-
'appid': Config.WOLFRAM_APP_ID
52-
}
53-
answer = requests.get(
54-
url='http://api.wolframalpha.com/v2/query',
55-
params=params
56-
)
57-
return WolframResult(parse(answer.content))

0 commit comments

Comments
 (0)