coocan 0.4.3__tar.gz → 0.4.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: coocan
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Air Spider Framework
5
5
  Author: wauo
6
6
  Author-email: markadc@126.com
@@ -0,0 +1,41 @@
1
+ from pathlib import Path
2
+
3
+ import click
4
+
5
+ TEMPLATE_DIR = Path(__file__).parent / "templates"
6
+
7
+
8
+ @click.group()
9
+ def main():
10
+ """爬虫者的贴心助手
11
+ \b
12
+ 可用命令:
13
+ new - 创建新的爬虫文件
14
+ \b
15
+ 示例:
16
+ cc new -s demo
17
+ """
18
+
19
+
20
+ @main.command()
21
+ @click.option('-s', '--spider', required=True, help='爬虫文')
22
+ def new(spider):
23
+ """新建"""
24
+ spider_file_name = "{}.py".format(spider)
25
+ try:
26
+ template_path = TEMPLATE_DIR / "spider.py"
27
+ with open(template_path, 'r') as f:
28
+ content = f.read()
29
+
30
+ with open(spider_file_name, 'w') as f:
31
+ f.write(content)
32
+
33
+ click.echo("Success create spider file {}".format(spider_file_name))
34
+
35
+ except Exception as e:
36
+ click.echo(str(e))
37
+ raise click.ClickException("Failed")
38
+
39
+
40
+ if __name__ == '__main__':
41
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: coocan
3
- Version: 0.4.3
3
+ Version: 0.4.4
4
4
  Summary: Air Spider Framework
5
5
  Author: wauo
6
6
  Author-email: markadc@126.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="coocan",
5
- version="0.4.3",
5
+ version="0.4.4",
6
6
  author="wauo",
7
7
  author_email="markadc@126.com",
8
8
  description="Air Spider Framework",
@@ -1,29 +0,0 @@
1
- from pathlib import Path
2
-
3
- import click
4
-
5
- TEMPLATE_DIR = Path(__file__).parent / "templates"
6
-
7
-
8
- @click.command()
9
- @click.option('-s', '--spider', required=True, help='新建爬虫')
10
- def main(spider):
11
- spider_file_name = "{}.py".format(spider)
12
- try:
13
-
14
- template_path = TEMPLATE_DIR / "spider.py"
15
- with open(template_path, 'r') as f:
16
- content = f.read()
17
-
18
- with open(spider_file_name, 'w') as f:
19
- f.write(content)
20
-
21
- click.echo("Success Create Spider {}".format(spider_file_name))
22
-
23
- except Exception as e:
24
- click.echo(str(e))
25
- raise click.ClickException("Failed Create Spider {}".format(spider_file_name))
26
-
27
-
28
- if __name__ == '__main__':
29
- main()
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