summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/weather.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/weather.py b/modules/weather.py
index 9e44721..60dc183 100644
--- a/modules/weather.py
+++ b/modules/weather.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+#-*- coding: utf-8 -*-
info = {
'author': 'Atle H. Havsø',
@@ -16,6 +16,7 @@ server = "http://api.wolframalpha.com/v2/query?"
class Module:
def __init__(self, bot):
self.appid = config.get('module/weather', 'api_key')
+ self.location = config.get('module/weather', 'location')
self.irc = bot
self.irc.register_keyword('!weather', self)
@@ -32,7 +33,7 @@ class Module:
def search(self, input):
- query = server + "appid=" + self.appid + "&input=weather%20" + input + "&format=plaintext"
+ query = server + "appid=" + self.appid + "&input=weather%20" + input + "&format=plaintext&location=" + self.location
try:
result = urllib2.urlopen(query)
result = result.read()
@@ -44,7 +45,6 @@ class Module:
def parseXml(self, result):
root = xml.XML(result)
- #root = tree.getroot()
data = []
for pod in root:
for subpod in pod:
@@ -58,7 +58,7 @@ class Module:
if __name__ == '__main__':
import sys
- m = Module()
+ m = Module(None)
search = ' '.join(sys.argv[1:])
result = m.search(search)
print(result.encode("utf-8"))