coocan 0.5.0__tar.gz → 0.5.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.5.0 → coocan-0.5.2}/PKG-INFO +4 -1
- {coocan-0.5.0 → coocan-0.5.2}/coocan/cmd/cli.py +8 -12
- coocan-0.5.2/coocan/push_project.py +12 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan.egg-info/PKG-INFO +4 -1
- {coocan-0.5.0 → coocan-0.5.2}/coocan.egg-info/SOURCES.txt +1 -0
- {coocan-0.5.0 → coocan-0.5.2}/setup.py +1 -1
- {coocan-0.5.0 → coocan-0.5.2}/README.md +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/__init__.py +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/cmd/__init__.py +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/gen.py +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/spider/__init__.py +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/spider/base.py +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/templates/spider.txt +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/url/__init__.py +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/url/request.py +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan/url/response.py +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan.egg-info/dependency_links.txt +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan.egg-info/entry_points.txt +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan.egg-info/requires.txt +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/coocan.egg-info/top_level.txt +0 -0
- {coocan-0.5.0 → coocan-0.5.2}/setup.cfg +0 -0
@@ -1,11 +1,14 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: coocan
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.2
|
4
4
|
Summary: Air Spider Framework
|
5
5
|
Author: wauo
|
6
6
|
Author-email: markadc@126.com
|
7
7
|
Requires-Python: >=3.10
|
8
8
|
Description-Content-Type: text/markdown
|
9
|
+
Requires-Dist: click>=8.0.0
|
10
|
+
Requires-Dist: httpx
|
11
|
+
Requires-Dist: loguru
|
9
12
|
|
10
13
|
# 项目说明
|
11
14
|
|
@@ -16,10 +16,6 @@ help_info = """
|
|
16
16
|
"""
|
17
17
|
|
18
18
|
|
19
|
-
def show_help_info():
|
20
|
-
print(help_info)
|
21
|
-
|
22
|
-
|
23
19
|
def snake_to_pascal(snake_str: str):
|
24
20
|
"""小蛇变成大驼峰"""
|
25
21
|
words = snake_str.split('_')
|
@@ -31,37 +27,37 @@ def snake_to_pascal(snake_str: str):
|
|
31
27
|
@click.pass_context
|
32
28
|
def main(ctx):
|
33
29
|
if ctx.invoked_subcommand is None:
|
34
|
-
|
30
|
+
print(help_info)
|
35
31
|
click.echo("cc new -s <spider_file_name>")
|
36
32
|
|
37
33
|
|
38
34
|
@main.command()
|
39
35
|
@click.option('-s', '--spider', required=True, help='爬虫文件名字')
|
40
|
-
def new(spider):
|
36
|
+
def new(spider: str):
|
41
37
|
"""新建"""
|
42
38
|
if not re.search("^[a-zA-Z0-9_]*$", spider):
|
43
39
|
click.echo("只支持字母、数字、下划线")
|
44
40
|
return
|
45
41
|
|
46
|
-
|
47
|
-
if not
|
48
|
-
|
42
|
+
spider_class_name = snake_to_pascal(spider)
|
43
|
+
if not spider_class_name.lower().endswith("spider"):
|
44
|
+
spider_class_name += "Spider"
|
49
45
|
|
50
46
|
try:
|
51
47
|
template_path = TEMPLATE_DIR / "spider.txt"
|
52
48
|
with open(template_path, 'r') as f:
|
53
49
|
text = f.read()
|
54
|
-
spider_py_text = text.replace("{SpiderClassName}",
|
50
|
+
spider_py_text = text.replace("{SpiderClassName}", spider_class_name)
|
55
51
|
|
56
52
|
py_file = "{}.py".format(spider)
|
57
53
|
if os.path.exists(py_file):
|
58
|
-
click.echo("
|
54
|
+
click.echo("Failed because file {} already exists".format(py_file))
|
59
55
|
return
|
60
56
|
|
61
57
|
with open(py_file, 'w') as f:
|
62
58
|
f.write(spider_py_text)
|
63
59
|
|
64
|
-
click.echo("Success")
|
60
|
+
click.echo("Success create {}".format(py_file))
|
65
61
|
|
66
62
|
except Exception as e:
|
67
63
|
click.echo(str(e))
|
@@ -1,11 +1,14 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: coocan
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.2
|
4
4
|
Summary: Air Spider Framework
|
5
5
|
Author: wauo
|
6
6
|
Author-email: markadc@126.com
|
7
7
|
Requires-Python: >=3.10
|
8
8
|
Description-Content-Type: text/markdown
|
9
|
+
Requires-Dist: click>=8.0.0
|
10
|
+
Requires-Dist: httpx
|
11
|
+
Requires-Dist: loguru
|
9
12
|
|
10
13
|
# 项目说明
|
11
14
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|