coocan 0.3__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {coocan-0.3 → coocan-0.3.2}/PKG-INFO +1 -1
- coocan-0.3.2/coocan/spider/__init__.py +1 -0
- {coocan-0.3 → coocan-0.3.2}/coocan/spider/base.py +1 -1
- {coocan-0.3 → coocan-0.3.2}/coocan/url/request.py +6 -1
- {coocan-0.3 → coocan-0.3.2}/coocan/url/response.py +1 -1
- {coocan-0.3 → coocan-0.3.2}/coocan.egg-info/PKG-INFO +1 -1
- {coocan-0.3 → coocan-0.3.2}/setup.py +1 -1
- coocan-0.3/coocan/spider/__init__.py +0 -1
- {coocan-0.3 → coocan-0.3.2}/coocan/__init__.py +0 -0
- {coocan-0.3 → coocan-0.3.2}/coocan/url/__init__.py +0 -0
- {coocan-0.3 → coocan-0.3.2}/coocan.egg-info/SOURCES.txt +0 -0
- {coocan-0.3 → coocan-0.3.2}/coocan.egg-info/dependency_links.txt +0 -0
- {coocan-0.3 → coocan-0.3.2}/coocan.egg-info/top_level.txt +0 -0
- {coocan-0.3 → coocan-0.3.2}/setup.cfg +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
from coocan.spider.base import MiniSpider
|
@@ -17,5 +17,10 @@ class Request:
|
|
17
17
|
self.cb_kwargs = cb_kwargs or {}
|
18
18
|
|
19
19
|
async def send(self):
|
20
|
-
|
20
|
+
if (self.data and self.json) is None:
|
21
|
+
response = await cli.get(self.url, params=self.params, headers=self.headers, timeout=self.timeout)
|
22
|
+
elif self.data or self.json:
|
23
|
+
response = await cli.post(self.url, params=self.params, headers=self.headers, data=self.data, json=self.json, timeout=self.timeout)
|
24
|
+
else:
|
25
|
+
raise Exception("仅支持 GET 和 POST 请求")
|
21
26
|
return response
|
@@ -37,7 +37,7 @@ class SelectorResponse(Response):
|
|
37
37
|
if self.status_code not in codes:
|
38
38
|
raise ResponseCodeError("{} not in {}".format(self.status_code, codes))
|
39
39
|
|
40
|
-
def raise_for_text(self, validate: Callable[[str], bool]
|
40
|
+
def raise_for_text(self, validate: Callable[[str], bool]):
|
41
41
|
if validate(self.text) is False:
|
42
42
|
raise ResponseTextError("not ideal text")
|
43
43
|
|
@@ -1 +0,0 @@
|
|
1
|
-
from coocan.spider.base import AirAsyncSpider
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|