Spaces:
Sleeping
Sleeping
Neurolingua
commited on
Commit
•
4d5b15d
1
Parent(s):
e8db129
Update other_function.py
Browse files- other_function.py +14 -0
other_function.py
CHANGED
@@ -111,6 +111,10 @@ def get_weather(city):
|
|
111 |
degree=temperature[:-2]
|
112 |
celcius=str(round((int(degree) - 32)* 5/9,1))+temperature[-2]+'C'
|
113 |
return (celcius)
|
|
|
|
|
|
|
|
|
114 |
from twisted.internet import reactor, defer
|
115 |
from scrapy.crawler import CrawlerRunner
|
116 |
from scrapy.utils.project import get_project_settings
|
@@ -144,3 +148,13 @@ def get_rates():
|
|
144 |
# Convert the list of data to a string
|
145 |
result = ''.join([str(d) for d in data]) + ' These prices are for 1 kg'
|
146 |
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
degree=temperature[:-2]
|
112 |
celcius=str(round((int(degree) - 32)* 5/9,1))+temperature[-2]+'C'
|
113 |
return (celcius)
|
114 |
+
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
from twisted.internet import reactor, defer
|
119 |
from scrapy.crawler import CrawlerRunner
|
120 |
from scrapy.utils.project import get_project_settings
|
|
|
148 |
# Convert the list of data to a string
|
149 |
result = ''.join([str(d) for d in data]) + ' These prices are for 1 kg'
|
150 |
return result
|
151 |
+
|
152 |
+
def get_rates_async(callback):
|
153 |
+
def task():
|
154 |
+
d = get_rates()
|
155 |
+
d.addCallback(callback)
|
156 |
+
d.addErrback(lambda failure: callback("Error fetching rates"))
|
157 |
+
|
158 |
+
from twisted.internet import reactor
|
159 |
+
reactor.callFromThread(task)
|
160 |
+
|