In my case I was able to overcome the issue by configuring a DNS resolver and uploading the code via USB

import network # set CloudFlare DNS resolver network.ipconfig(dns="1.1.1.1")