Help Please
I am trying to receive the response back from my google App-Script, since it is redirected, I can not proceed in my code, because request response is used to decide function of the hardware. I am very new to micro Python and I am using ESP8266 and uPyCraft installed in a windows 10 machine. I have attached the code used and the output I got for reference. I came to know that above post had solved the issues, but I did not know how to replace the original urequest module with the pycopy-lib/urequests/ downloaded from
https://github.com/pfalcon/pycopy-lib/t ... /urequests as zip file. I searched and tried a lot for more than three days, but i am unable to do things up. So kindly provide a detailed instructions. Looking Forward, Thanks in advance.
Code: Select all
import network, time, urequests
print("-----Import OK-----")
ssid = 'WiFi'
password = 'embedded*7'
station = network.WLAN(network.STA_IF)
station.active(True)
station.connect(ssid, password)
while station.isconnected() == False:
pass
print('SSID : ', ssid)
print('PASS : ', password)
print('IP ADD :', station.ifconfig()[0])
time.sleep(1)
url = 'https://script.google.com/macros/s/AKfycbzeBzs4xpdj5pMRpcyERt6xyLOBfoxjgktumoDxKoaQjXXXXXXXX/exec?'
url = url + 'station_id=tuticorin'
try:
global request
request = urequests.get(url=url)
print(request.text)
except Exception as e:
print("EXCEPTION CAPTURED:\n",e)
OUTPUT:
Code: Select all
>>>
Ready to download this file,please wait!
.......
download ok
exec(open('./socket_http_post.py').read(),globals())
-----Import OK-----
SSID : WiFi
PASS : embedded*7
IP ADD : 192.168.1.106
EXCEPTION CAPTURED:
Redirects not yet supported
>>>