diff --git a/docs/additional/news.md b/docs/additional/news.md index 1fe6b8c..6c7e708 100644 --- a/docs/additional/news.md +++ b/docs/additional/news.md @@ -1,5 +1,31 @@ # Release notes +## AyugeSpiderTools 3.3.2 (2023-07-26) + +### Deprecation removals + +- 无。 + +### Deprecations + +- 无。 + +### New features + +- 增加贝塞尔曲线生成轨迹的示例方法。 + +### Bug fixes + +- 无。 + +### Code optimizations + +- 将项目中有关文件的操作统一改为 `pathlib` 的方式。 +- 根据 `consul` 获取配置的方式添加缓存处理,不用每次运行都多次调用同样参数来获取配置。减少请求次数,提高运行效率。 +- 更新 `README.md` 内容,增加对应英文版本。 + +
+ ## AyugeSpiderTools 3.3.1 (2023-06-29) ### Deprecation removals diff --git a/pyproject.toml b/pyproject.toml index 0fa7fc0..b1e7908 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "AyugeSpiderTools" -version = "3.3.1" -description = "scrapy 扩展库:用于扩展 Scrapy 功能来解放双手,还内置一些爬虫开发中的通用方法。" +version = "3.3.2" +description = "scrapy 扩展库:用于扩展 Scrapy 功能来解放双手。" authors = ["ayuge "] maintainers = ["ayuge "] readme = "README.md" diff --git a/tests/docs/image/mongo_upload.png b/tests/docs/image/mongo_upload.png new file mode 100644 index 0000000..c631074 Binary files /dev/null and b/tests/docs/image/mongo_upload.png differ diff --git a/tests/test_mongoclient.py b/tests/test_mongoclient.py index 921d77b..bf2c1c4 100644 --- a/tests/test_mongoclient.py +++ b/tests/test_mongoclient.py @@ -143,18 +143,15 @@ def test_find(): def test_upload(): """测试 mongoDB 上传图片方法""" - import requests - mongodb = MongoDbBase(**mongodb_ori) - r = requests.get(url="https://static.jzmbti.com/ceshi/qn/1002.png") - content_type = dict(r.headers)["Content-Type"] - print("图片的类型 content_type 为:", content_type) + png_bytes = Path(tests_dir, "docs/image/mongo_upload.png").read_bytes() + # 返回上传后的 ID 及图片链接 mongo_upload_id, image_id = mongodb.upload( file_name="test2.jpg", _id="121212121213", - content_type=content_type, + content_type="image/png", collection="fs", - file_data=r.content, + file_data=png_bytes, ) assert mongo_upload_id is not None, image_id is not None