coocan 0.4.7__tar.gz → 0.4.8__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.4.7 → coocan-0.4.8}/PKG-INFO +1 -1
- {coocan-0.4.7 → coocan-0.4.8}/coocan/cmd/cli.py +9 -3
- {coocan-0.4.7/coocan/cmd → coocan-0.4.8/coocan}/templates/spider.txt +2 -1
- {coocan-0.4.7 → coocan-0.4.8}/coocan.egg-info/PKG-INFO +1 -1
- {coocan-0.4.7 → coocan-0.4.8}/coocan.egg-info/SOURCES.txt +1 -1
- {coocan-0.4.7 → coocan-0.4.8}/setup.py +2 -2
- {coocan-0.4.7 → coocan-0.4.8}/README.md +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan/__init__.py +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan/cmd/__init__.py +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan/gen.py +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan/spider/__init__.py +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan/spider/base.py +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan/url/__init__.py +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan/url/request.py +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan/url/response.py +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan.egg-info/dependency_links.txt +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan.egg-info/entry_points.txt +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan.egg-info/requires.txt +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/coocan.egg-info/top_level.txt +0 -0
- {coocan-0.4.7 → coocan-0.4.8}/setup.cfg +0 -0
@@ -1,9 +1,10 @@
|
|
1
|
+
import os
|
1
2
|
import re
|
2
3
|
from pathlib import Path
|
3
4
|
|
4
5
|
import click
|
5
6
|
|
6
|
-
TEMPLATE_DIR = Path(__file__).parent /
|
7
|
+
TEMPLATE_DIR = Path(__file__).parent.parent / 'templates'
|
7
8
|
|
8
9
|
help_info = """
|
9
10
|
██████╗ ██████╗ ██████╗ ██████╗ █████╗ ███╗ ██╗
|
@@ -26,7 +27,7 @@ def snake_to_pascal(snake_str: str):
|
|
26
27
|
return pascal_str
|
27
28
|
|
28
29
|
|
29
|
-
@click.group(invoke_without_command=True)
|
30
|
+
@click.group(invoke_without_command=True)
|
30
31
|
@click.pass_context
|
31
32
|
def main(ctx):
|
32
33
|
if ctx.invoked_subcommand is None:
|
@@ -52,7 +53,12 @@ def new(spider):
|
|
52
53
|
text = f.read()
|
53
54
|
spider_py_text = text.replace("{SpiderClassName}", pascal)
|
54
55
|
|
55
|
-
|
56
|
+
py_file = "{}.py".format(spider)
|
57
|
+
if os.path.exists(py_file):
|
58
|
+
click.echo("File {} already exists".format(py_file))
|
59
|
+
return
|
60
|
+
|
61
|
+
with open(py_file, 'w') as f:
|
56
62
|
f.write(spider_py_text)
|
57
63
|
|
58
64
|
click.echo("Success")
|
@@ -10,9 +10,9 @@ coocan.egg-info/requires.txt
|
|
10
10
|
coocan.egg-info/top_level.txt
|
11
11
|
coocan/cmd/__init__.py
|
12
12
|
coocan/cmd/cli.py
|
13
|
-
coocan/cmd/templates/spider.txt
|
14
13
|
coocan/spider/__init__.py
|
15
14
|
coocan/spider/base.py
|
15
|
+
coocan/templates/spider.txt
|
16
16
|
coocan/url/__init__.py
|
17
17
|
coocan/url/request.py
|
18
18
|
coocan/url/response.py
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
|
|
5
5
|
|
6
6
|
setup(
|
7
7
|
name="coocan",
|
8
|
-
version="0.4.
|
8
|
+
version="0.4.8",
|
9
9
|
author="wauo",
|
10
10
|
author_email="markadc@126.com",
|
11
11
|
description="Air Spider Framework",
|
@@ -24,7 +24,7 @@ setup(
|
|
24
24
|
],
|
25
25
|
},
|
26
26
|
package_data={
|
27
|
-
'coocan
|
27
|
+
'coocan': ['templates/*'],
|
28
28
|
},
|
29
29
|
include_package_data=True
|
30
30
|
)
|
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
|