one good project :D

使用Pi将湿度和温度数据记录到云端
本文介绍如何利用Arduino Pi板收集环境的湿度和温度数据,并通过GDocs进行实时数据记录。
C:\Users\86176\PycharmProjects\PythonProject15\venv\Scripts\python.exe "D:/python/PyCharm Community Edition 2024.3.5/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py" --path C:\Users\86176\PycharmProjects\PythonProject15\tests\test_conde.py Testing started at 00:13 ... Launching pytest with arguments C:\Users\86176\PycharmProjects\PythonProject15\tests\test_conde.py --no-header --no-summary -q in C:\Users\86176\PycharmProjects\PythonProject15\tests ============================= test session starts ============================= collecting ... collected 6 items test_conde.py::Test_Conde::test_topics test_conde.py::Test_Conde::test_topicsdetails test_conde.py::Test_Conde::test_updatatopic test_conde.py::Test_Conde::test_de_collect test_conde.py::Test_Conde::test_collecttopics test_conde.py::Test_Conde::test_replies ======================== 1 failed, 5 passed in 11.59s ========================= {'headers': {'Content-Type': 'application/json'}, 'ip': 'https://cnodejs.org/api/v1/', 'token': '72d70b7e-d2f7-4088-b773-e58b1c80a290', 'topics_id': '688a0c31f135766bd30832e3'} {'headers': {'Content-Type': 'application/json'}, 'ip': 'https://cnodejs.org/api/v1/', 'token': '72d70b7e-d2f7-4088-b773-e58b1c80a290', 'topics_id': '688a0c31f135766bd30832e3'} 主题首页的响应结果: {'success': True, 'data': [{'id': '688a0f96f1357644340832e9', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>测试主题Tjdl62</p>\n</div>', 'title': '这是测试的主题vHFZ8', 'last_reply_at': '2025-07-30T12:27:02.770Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 86, 'create_at': '2025-07-30T12:27:02.770Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}}, {'id': '688a0c87f1357620e90832e5', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>测试主题AGbm35</p>\n</div>', 'title': '这是测试的主题wMBj58', 'last_reply_at': '2025-07-30T12:13:59.796Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 46, 'create_at': '2025-07-30T12:13:59.796Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}}, {'id': '688a0c31f135766bd30832e3', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>测试主题iLBb23</p>\n</div>', 'title': '这是测试的主题zkMX23', 'last_reply_at': '2025-07-30T12:12:33.525Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 63, 'create_at': '2025-07-30T12:12:33.525Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}}, {'id': '688a0a85f13576f8230832df', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>主题内容JAGeZ33</p>\n</div>', 'title': '这是要测试的主题mCxC85', 'last_reply_at': '2025-07-30T12:05:25.867Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 50, 'create_at': '2025-07-30T12:05:25.867Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}}, {'id': '688a06bff13576221d0832d6', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>主题内容</p>\n</div>', 'title': '这是要测试的主题', 'last_reply_at': '2025-07-30T11:49:19.692Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 56, 'create_at': '2025-07-30T11:49:19.692Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}}, {'id': '688a05abf1357665ac0832d2', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>主题内容</p>\n</div>', 'title': '这是要测试的主题', 'last_reply_at': '2025-07-30T11:44:43.829Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 48, 'create_at': '2025-07-30T11:44:43.829Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}}, {'id': '686d2244f13576585f082ef4', 'author_id': '59315c6d64c9781e4812c952', 'tab': 'ask', 'content': '<div class="markdown-text"><p><img src="//static.cnodejs.org/FsSMCl8OyWMYXUxFbAF6fyUJ12X9" alt="heap.png"></p>\n<p>rss特别高但是js堆的内存都不高,通过–inspect我也拿不到这部分堆外内容的内存快照。\n我拿到的内存快照都只有50m左右大小,完全和rss不匹配\n有什么有效的排查思路/方法吗?</p>\n<p>// 补充\n图不知道为什么裂了。。。\n补充:\nrss - 1648.1mb\nextrenal - 2.26mb\nusedHeap - 49.97mb\ntotalHeap - 59.35mb</p>\n</div>', 'title': '【求助】内存泄漏排查', 'last_reply_at': '2025-07-29T06:41:05.636Z', 'good': False, 'top': False, 'reply_count': 4, 'visit_count': 577, 'create_at': '2025-07-08T13:51:00.415Z', 'author': {'loginname': 'tangtangtangtangtang', 'avatar_url': 'https://avatars.githubusercontent.com/u/24206594?v=4&s=120'}}, {'id': '6887aaf9f135766bfe0831fa', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>主题内容</p>\n</div>', 'title': '这是要测试的主题', 'last_reply_at': '2025-07-28T16:53:13.601Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 119, 'create_at': '2025-07-28T16:53:13.601Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}}, {'id': '68862adff13576c3c90831d4', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>主题内容</p>\n</div>', 'title': '这是要测试的主题', 'last_reply_at': '2025-07-27T13:34:23.484Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 123, 'create_at': '2025-07-27T13:34:23.484Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}}, {'id': '682a3b1a982e400de6722c81', 'author_id': '60d169c1248d04e60a4ae5de', 'tab': 'ask', 'content': '<div class="markdown-text"><p>最近在找工作,感觉很卷,真的完蛋了吗</p>\n</div>', 'title': '35岁的前端真的完蛋了吗?', 'last_reply_at': '2025-07-11T13:12:30.692Z', 'good': False, 'top': False, 'reply_count': 14, 'visit_count': 1775, 'create_at': '2025-05-18T19:55:06.731Z', 'author': {'loginname': 'dyjiang', 'avatar_url': 'https://avatars.githubusercontent.com/u/37732251?v=4&s=120'}}]} PASSED主题详情的响应结果: {'success': True, 'data': {'id': '688a0c31f135766bd30832e3', 'author_id': '6844fce5f1357687c5082263', 'tab': 'ask', 'content': '<div class="markdown-text"><p>测试主题iLBb23</p>\n</div>', 'title': '这是测试的主题zkMX23', 'last_reply_at': '2025-07-30T12:12:33.525Z', 'good': False, 'top': False, 'reply_count': 0, 'visit_count': 64, 'create_at': '2025-07-30T12:12:33.525Z', 'author': {'loginname': 'fanmao54', 'avatar_url': '//gravatar.com/avatar/a3f848723b9dc33dfbdad1a8aa937cde?size=48'}, 'replies': [], 'is_collect': False}} PASSED编辑主题的响应结果: {'success': True, 'topic_id': '688a0c31f135766bd30832e3'} PASSED取消收藏主题的响应结果: {'success': True} PASSED收藏主题的响应结果: {'success': True} PASSEDFAILED tests\test_conde.py:43 (Test_Conde.test_replies) self = <Response [404]>, kwargs = {} def json(self, **kwargs): r"""Returns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. :raises requests.exceptions.JSONDecodeError: If the response body does not contain valid json. """ if not self.encoding and self.content and len(self.content) > 3: # No encoding set. JSON RFC 4627 section 3 states we should expect # UTF-8, -16 or -32. Detect which one to use; If the detection or # decoding fails, fall back to `self.text` (using charset_normalizer to make # a best guess). encoding = guess_json_utf(self.content) if encoding is not None: try: return complexjson.loads(self.content.decode(encoding), **kwargs) except UnicodeDecodeError: # Wrong UTF codec detected; usually because it's not UTF-8 # but some other 8-bit codec. This is an RFC violation, # and the server didn't bother to tell us what codec *was* # used. pass except JSONDecodeError as e: raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) try: > return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ..\..\..\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py:974: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ..\..\..\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py:346: in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ ..\..\..\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:337: in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <json.decoder.JSONDecoder object at 0x0000023876655160> s = '<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /api/v1/topic/:topic/688a0c31f135766bd30832e3/replies</pre>\n</body>\n</html>\n' idx = 0 def raw_decode(self, s, idx=0): """Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. """ try: obj, end = self.scan_once(s, idx) except StopIteration as err: > raise JSONDecodeError("Expecting value", s, err.value) from None E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ..\..\..\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py:355: JSONDecodeError During handling of the above exception, another exception occurred: self = <tests.test_conde.Test_Conde object at 0x0000023879610590> def test_replies(self):#新建评论 r = Replies(accesstoken=self.g.token,content="这是评论"+''.join(random.choice(string.ascii_letters)for _ in range(4))+str(random.randint(0,100))) > res = self.b.reply_id(r) ^^^^^^^^^^^^^^^^^^ test_conde.py:46: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ..\controller\base_controller.py:63: in reply_id print("新建评论的响应结果:", res.json()) ^^^^^^^^^^ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Response [404]>, kwargs = {} def json(self, **kwargs): r"""Returns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. :raises requests.exceptions.JSONDecodeError: If the response body does not contain valid json. """ if not self.encoding and self.content and len(self.content) > 3: # No encoding set. JSON RFC 4627 section 3 states we should expect # UTF-8, -16 or -32. Detect which one to use; If the detection or # decoding fails, fall back to `self.text` (using charset_normalizer to make # a best guess). encoding = guess_json_utf(self.content) if encoding is not None: try: return complexjson.loads(self.content.decode(encoding), **kwargs) except UnicodeDecodeError: # Wrong UTF codec detected; usually because it's not UTF-8 # but some other 8-bit codec. This is an RFC violation, # and the server didn't bother to tell us what codec *was* # used. pass except JSONDecodeError as e: raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) try: return complexjson.loads(self.text, **kwargs) except JSONDecodeError as e: # Catch JSON-related errors and raise as requests.JSONDecodeError # This aliases json.JSONDecodeError and simplejson.JSONDecodeError > raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) E requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ..\..\..\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py:978: JSONDecodeError 进程已结束,退出代码为 1
最新发布
08-02
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值