Skip to content

Issues when using ftplib on ESP32 together with Micropython's built-in "requests" module #25

Description

@PV-autarky-optimizer

I tested micropython-ftplib with Micropython on my ESP32 and it works well. That is the good News.

I found ftplib is incompatible to Micropython's intrinsic library requests for ESP32. I have Micropython v1.24.1 installed via Thonny IDE.
It's a pitty.

My Micropython code is like this:

import network                  # This library provides WLAN
from ftplib import FTP as FTP   # FTP Client from github.com/SpotlightKid
import requests as requests     # This library belongs to Micropython and carries out GET requests in the HTTP protocol. 
... setup_WLAN() ... 
response = requests.get('https://s18.myenergi.net/cgi-jstatus-*', headers = {'User-Agent': '...'}, auth = None, timeout=20)

As soon as ftplib is imported, requests.get fails to access the internet and after timeout it returns the error [Errno 116] ETIMEDOUT.

This incompatibility occures both with ftplib.py and esp/ftplib.py

By the way, in ftplib.py, line 353, fix the bug by changing b'\n' to '\n'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions