File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ #from eventlet.green.urllib.request import urlopen
2
+ #import json
3
+
4
+ urls = [
5
+ "http://weather.livedoor.com/forecast/webservice/json/v1?city=140010",
6
+ "http://weather.livedoor.com/forecast/webservice/json/v1?city=130010",
7
+ "http://weather.livedoor.com/forecast/webservice/json/v1?city=400040"
8
+ ] * 10
9
+
10
+
11
+ def read(url):
12
+ from eventlet.green.urllib.request import urlopen
13
+ import json
14
+
15
+ weather = urlopen(url).read().decode('utf-8') |> json.loads()
16
+ print(weather['title'])
17
+ map(-> print($1['dateLabel'], $1['telop']),
18
+ weather['forecasts']) |> doall()
19
+ print('')
20
+
21
+
22
+ def fetch():
23
+ from eventlet.green.urllib.request import urlopen
24
+ import json
25
+
26
+ receive:
27
+ url: read(url)
28
+
29
+ urls !&> spawn_mc(fetch)
30
+ wait_all()
You can’t perform that action at this time.
0 commit comments