micropython / micropython/micropython-lib
requests: requests.get() blocks infinitely
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 2.9k
- フォーク
- 1.1k
- 平均マージ
- 7日 6時間
- マージ済み PR(30日)
- 3
説明
I am trying to call requests.get(some_REST_API_call) on a Pico W (with v1.22.1) but this call blocks infinitely.
Using a timeout or non-blocking mode (timeout=0) doesn't help.
The call works with CPython and in Chrome and returns some small JSON.
When using self._cached = self.raw.recv(10000) instead of self._cached = self.raw.read()
in requests/__init__.py (line 20) the call works fine.
So shouldn't this read() be replaced with a loop which tries to recv(num_bytes)
until it read less than num_bytes and then stops?
Update: Tested this with a different kind of device (calling the ThingSpeak API with requests.post) and for that only read() works correctly. recv(num_bytes) yields no bytes.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
requests/init.py の20行目付近から始め、説明されている Pico W requests.get と requests.post のケースを再現します。raw.read() と raw.recv(10000) のブロッキング動作と返されるデータを、timeout=0 の場合も含めて比較します。完了とは、各デバイスで現在機能しているレスポンスの動作を維持しながら、対象の呼び出しがハングせずに完了することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- networking
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100