質問編集履歴

1

エラーメッセージ全文を追記しました。

2019/03/15 04:49

投稿

MacKimura
MacKimura

スコア15

test CHANGED
File without changes
test CHANGED
@@ -119,3 +119,151 @@
119
119
  files.download(filename)
120
120
 
121
121
  ```
122
+
123
+
124
+
125
+
126
+
127
+ ### エラーメッセージ
128
+
129
+
130
+
131
+ EVgo: Electric Vehicle (EV) Charging Stations | EV Fast Charging
132
+
133
+ Charge!!!
134
+
135
+ PlugShare - EV Charging Station Map - Find a place to charge your ...News for EV charge
136
+
137
+
138
+
139
+ ---------------------------------------------------------------------------
140
+
141
+ MissingSchema Traceback (most recent call last)
142
+
143
+ <ipython-input-20-932ef3fb8f3f> in <module>()
144
+
145
+ 44
146
+
147
+ 45 keyword = "EV charge"
148
+
149
+ ---> 46 search_results_df = get_search_results_df(keyword)
150
+
151
+ 47 search_results_df.head(10)
152
+
153
+ 48
154
+
155
+
156
+
157
+ <ipython-input-20-932ef3fb8f3f> in get_search_results_df(keyword)
158
+
159
+ 17 print(title)
160
+
161
+ 18 url = query_string_remove(tag.select("a")[0].get("href").replace("/url?q=",""))
162
+
163
+ ---> 19 affiliate_url = get_a8_links(url) # 作成したコードの追加
164
+
165
+ 20 se = pd.Series([rank, title, url, affiliate_url], columns)
166
+
167
+ 21 df = df.append(se, ignore_index=True)
168
+
169
+
170
+
171
+ <ipython-input-20-932ef3fb8f3f> in get_a8_links(url)
172
+
173
+ 25
174
+
175
+ 26 def get_a8_links(url):
176
+
177
+ ---> 27 html_doc = requests.get(url).text
178
+
179
+ 28 soup = BeautifulSoup(html_doc, 'html.parser')
180
+
181
+ 29 tags = soup.select("a")
182
+
183
+
184
+
185
+ /usr/local/lib/python3.6/dist-packages/requests/api.py in get(url, params, **kwargs)
186
+
187
+ 70
188
+
189
+ 71 kwargs.setdefault('allow_redirects', True)
190
+
191
+ ---> 72 return request('get', url, params=params, **kwargs)
192
+
193
+ 73
194
+
195
+ 74
196
+
197
+
198
+
199
+ /usr/local/lib/python3.6/dist-packages/requests/api.py in request(method, url, **kwargs)
200
+
201
+ 56 # cases, and look like a memory leak in others.
202
+
203
+ 57 with sessions.Session() as session:
204
+
205
+ ---> 58 return session.request(method=method, url=url, **kwargs)
206
+
207
+ 59
208
+
209
+ 60
210
+
211
+
212
+
213
+ /usr/local/lib/python3.6/dist-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
214
+
215
+ 492 hooks=hooks,
216
+
217
+ 493 )
218
+
219
+ --> 494 prep = self.prepare_request(req)
220
+
221
+ 495
222
+
223
+ 496 proxies = proxies or {}
224
+
225
+
226
+
227
+ /usr/local/lib/python3.6/dist-packages/requests/sessions.py in prepare_request(self, request)
228
+
229
+ 435 auth=merge_setting(auth, self.auth),
230
+
231
+ 436 cookies=merged_cookies,
232
+
233
+ --> 437 hooks=merge_hooks(request.hooks, self.hooks),
234
+
235
+ 438 )
236
+
237
+ 439 return p
238
+
239
+
240
+
241
+ /usr/local/lib/python3.6/dist-packages/requests/models.py in prepare(self, method, url, headers, files, data, params, auth, cookies, hooks, json)
242
+
243
+ 303
244
+
245
+ 304 self.prepare_method(method)
246
+
247
+ --> 305 self.prepare_url(url, params)
248
+
249
+ 306 self.prepare_headers(headers)
250
+
251
+ 307 self.prepare_cookies(cookies)
252
+
253
+
254
+
255
+ /usr/local/lib/python3.6/dist-packages/requests/models.py in prepare_url(self, url, params)
256
+
257
+ 377 error = error.format(to_native_string(url, 'utf8'))
258
+
259
+ 378
260
+
261
+ --> 379 raise MissingSchema(error)
262
+
263
+ 380
264
+
265
+ 381 if not host:
266
+
267
+
268
+
269
+ MissingSchema: Invalid URL '/search?q=EV+charge': No schema supplied. Perhaps you meant http:///search?q=EV+charge?