質問編集履歴
4
もう一つの問題への追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -307,3 +307,7 @@
|
|
307
307
|
</Root>
|
308
308
|
|
309
309
|
```
|
310
|
+
|
311
|
+
### 追記2
|
312
|
+
|
313
|
+
問題点としてはこのシステムを動かしているサーバが非同期処理をしないとすぐに固まってしまうため、非同期処理にしたいと思っています。
|
3
元XMLファイルURLの削除
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
eews = ''
|
24
24
|
|
25
|
-
xml_data_module = requests.get('https://
|
25
|
+
xml_data_module = requests.get('https://URL/data1.xml')
|
26
26
|
|
27
27
|
xml_data_module.encoding = "Shift_JIS"
|
28
28
|
|
@@ -100,7 +100,7 @@
|
|
100
100
|
|
101
101
|
async with aiohttp.ClientSession() as session:
|
102
102
|
|
103
|
-
async with session.get(url='https://
|
103
|
+
async with session.get(url='https://URL/file/data1.xml') as response:
|
104
104
|
|
105
105
|
xml_data = str(response)
|
106
106
|
|
@@ -136,7 +136,7 @@
|
|
136
136
|
|
137
137
|
Depth = (Earthquake.attrib['Depth'])
|
138
138
|
|
139
|
-
map_url = 'https://
|
139
|
+
map_url = 'https://URL/'
|
140
140
|
|
141
141
|
count = 1
|
142
142
|
|
@@ -169,3 +169,141 @@
|
|
169
169
|
return 'error'
|
170
170
|
|
171
171
|
```
|
172
|
+
|
173
|
+
### 追記1
|
174
|
+
|
175
|
+
data1.xml
|
176
|
+
|
177
|
+
```xml
|
178
|
+
|
179
|
+
<jishinReport>
|
180
|
+
|
181
|
+
<record date="2020年12月27日">
|
182
|
+
|
183
|
+
<item time="12時53分ごろ" shindo="1" url="https://URL/file/JSA0201227125306_20201227125546.xml">長野県南部</item>
|
184
|
+
|
185
|
+
<item time="04時09分ごろ" shindo="1" url="https://URL/file/JSA0201227040909_20201227041157.xml">茨城県沖</item>
|
186
|
+
|
187
|
+
</record>
|
188
|
+
|
189
|
+
<record date="2020年12月26日">
|
190
|
+
|
191
|
+
<item time="18時25分ごろ" shindo="1" url="https://URL/file/JSA0201226182534_20201226182816.xml">岐阜県美濃中西部</item>
|
192
|
+
|
193
|
+
<item time="06時32分ごろ" shindo="2" url="https://URL/file/JSA0201226063236_20201226063548.xml">岩手県沿岸北部</item>
|
194
|
+
|
195
|
+
<item time="00時13分ごろ" shindo="1" url="https://URL/file/JSA0201226001319_20201226001539.xml">北海道渡島地方東部</item>
|
196
|
+
|
197
|
+
</record>
|
198
|
+
|
199
|
+
<record date="2020年12月25日">
|
200
|
+
|
201
|
+
<item time="23時22分ごろ" shindo="1" url="https://URL/file/JSA0201225232200_20201225232434.xml">鹿児島湾</item>
|
202
|
+
|
203
|
+
<item time="13時12分ごろ" shindo="1" url="https://URL/file/JSA0201225131217_20201225131924.xml">熊本県熊本地方</item>
|
204
|
+
|
205
|
+
<item time="06時27分ごろ" shindo="2" url="https://URL/file/JSA0201225062739_20201225063052.xml">宮城県北部</item>
|
206
|
+
|
207
|
+
<item time="05時38分ごろ" shindo="2" url="https://URL/file/JSA0201225053846_20201225054236.xml">種子島近海</item>
|
208
|
+
|
209
|
+
<item time="05時35分ごろ" shindo="1" url="https://URL/file/JSA0201225053514_20201225053818.xml">長野県中部</item>
|
210
|
+
|
211
|
+
<item time="04時40分ごろ" shindo="2" url="https://URL/file/JSA0201225044015_20201225044331.xml">茨城県沖</item>
|
212
|
+
|
213
|
+
</record>
|
214
|
+
|
215
|
+
<record date="2020年12月24日">
|
216
|
+
|
217
|
+
<item time="21時58分ごろ" shindo="1" url="https://URL/file/JSA0201224215838_20201224220116.xml">岐阜県美濃中西部</item>
|
218
|
+
|
219
|
+
<item time="08時11分ごろ" shindo="2" url="https://URL/file/JSA0201224081149_20201224081451.xml">豊後水道</item>
|
220
|
+
|
221
|
+
<item time="03時18分ごろ" shindo="2" url="https://URL/file/JSA0201224031915_20201224032300.xml">京都府南部</item>
|
222
|
+
|
223
|
+
<item time="02時55分ごろ" shindo="3" url="https://URL/file/JSA0201224025558_20201224025946.xml">三重県南部</item>
|
224
|
+
|
225
|
+
</record>
|
226
|
+
|
227
|
+
<record date="2020年12月23日">
|
228
|
+
|
229
|
+
<item time="22時08分ごろ" shindo="1" url="https://URL/file/JSA0201223220844_20201223221144.xml">宮城県沖</item>
|
230
|
+
|
231
|
+
<item time="09時03分ごろ" shindo="1" url="https://URL/file/JSA0201223090306_20201223090609.xml">茨城県沖</item>
|
232
|
+
|
233
|
+
<item time="06時34分ごろ" shindo="1" url="https://URL/file/JSA0201223063447_20201223063756.xml">新島・神津島近海</item>
|
234
|
+
|
235
|
+
<item time="03時24分ごろ" shindo="1" url="https://URL/file/JSA0201223032445_20201223032817.xml">奄美大島北西沖</item>
|
236
|
+
|
237
|
+
<item time="02時04分ごろ" shindo="1" url="https://URL/file/JSA0201223020408_20201223020853.xml">福島県沖</item>
|
238
|
+
|
239
|
+
</record>
|
240
|
+
|
241
|
+
<record date="2020年12月22日">
|
242
|
+
|
243
|
+
<item time="16時30分ごろ" shindo="1" url="https://URL/file/JSA0201222163059_20201222163331.xml">新島・神津島近海</item>
|
244
|
+
|
245
|
+
<item time="11時52分ごろ" shindo="1" url="https://URL/file/JSA0201222115204_20201222115454.xml">岐阜県飛騨地方</item>
|
246
|
+
|
247
|
+
<item time="01時28分ごろ" shindo="1" url="https://URL/file/JSA0201222012850_20201222013130.xml">福島県浜通り</item>
|
248
|
+
|
249
|
+
<item time="00時41分ごろ" shindo="1" url="https://URL/file/JSA0201222004142_20201222004458.xml">栃木県北部</item>
|
250
|
+
|
251
|
+
</record>
|
252
|
+
|
253
|
+
<record date="2020年12月21日">
|
254
|
+
|
255
|
+
<item time="06時32分ごろ" shindo="1" url="https://URL/file/JSA0201221063214_20201221063512.xml">熊本県熊本地方</item>
|
256
|
+
|
257
|
+
<item time="02時23分ごろ" shindo="5-" url="https://URL/file/JSA0201221022252_20201221042011.xml">青森県東方沖</item>
|
258
|
+
|
259
|
+
<item time="02時04分ごろ" shindo="1" url="https://URL/file/JSA0201221020418_20201221020727.xml">新島・神津島近海</item>
|
260
|
+
|
261
|
+
<item time="01時25分ごろ" shindo="2" url="https://URL/file/JSA0201221012528_20201221012843.xml">北海道日高地方東部</item>
|
262
|
+
|
263
|
+
<item time="00時39分ごろ" shindo="3" url="https://URL/file/JSA0201221003912_20201221004231.xml">新島・神津島近海</item>
|
264
|
+
|
265
|
+
</record>
|
266
|
+
|
267
|
+
</jishinReport>
|
268
|
+
|
269
|
+
```
|
270
|
+
|
271
|
+
それぞれのURLの形式
|
272
|
+
|
273
|
+
```xml
|
274
|
+
|
275
|
+
<Root>
|
276
|
+
|
277
|
+
<Timestamp>2020/12/23 22:11:44</Timestamp>
|
278
|
+
|
279
|
+
<Earthquake Id="A0201223220844" Time="2020/12/23 22:08:00" Intensity="1" Epicenter="宮城県沖" Latitude="北緯 38.9度" Longitude="東経 142.6度" Magnitude="4.1" Depth="40km">
|
280
|
+
|
281
|
+
<Detail>data/JS00cwA0201223220844_20201223221144.jpg</Detail>
|
282
|
+
|
283
|
+
<Local>data/JS00cuA0201223220844_20201223221144.jpg</Local>
|
284
|
+
|
285
|
+
<Global>data/JS00clA0201223220844_20201223221144.jpg</Global>
|
286
|
+
|
287
|
+
<Relative>
|
288
|
+
|
289
|
+
<Group Intensity="1">
|
290
|
+
|
291
|
+
<Area Name="大船渡市"/>
|
292
|
+
|
293
|
+
<Area Name="一関市"/>
|
294
|
+
|
295
|
+
<Area Name="住田町"/>
|
296
|
+
|
297
|
+
<Area Name="気仙沼市"/>
|
298
|
+
|
299
|
+
<Area Name="南三陸町"/>
|
300
|
+
|
301
|
+
</Group>
|
302
|
+
|
303
|
+
</Relative>
|
304
|
+
|
305
|
+
</Earthquake>
|
306
|
+
|
307
|
+
</Root>
|
308
|
+
|
309
|
+
```
|
2
元々のコードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -78,7 +78,7 @@
|
|
78
78
|
|
79
79
|
map = map_url + Detail.text
|
80
80
|
|
81
|
-
edic = {'time': time, 'epicenter': Epicenter, "intensity": Intensity, "depth": Depth, "magnitude": Magnitude, "map": map, "icon":
|
81
|
+
edic = {'time': time, 'epicenter': Epicenter, "intensity": Intensity, "depth": Depth, "magnitude": Magnitude, "map": map, "icon": eicon(Intensity), "color": eicolor(Intensity), 'e_1': e_1}
|
82
82
|
|
83
83
|
return edic
|
84
84
|
|
1
タイトルに質問のメインである「非同期処理」というワードを追加した
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
pythonでXMLを読み取りたい
|
1
|
+
pythonでXMLを非同期処理で読み取りたい
|
test
CHANGED
File without changes
|