0

PyPortal Invalid Syntax
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: PyPortal Invalid Syntax

by slowjim on Mon Feb 10, 2020 5:16 pm

Hi mikeysklar

Originally it was on my phone, but I tried again on stable WiFi and I got the same result ☹️

slowjim
 
Posts: 18
Joined: Fri Sep 27, 2019 3:49 am

Re: PyPortal Invalid Syntax

by mikeysklar on Mon Feb 10, 2020 8:40 pm

James,

I noticed another thread on this topic and the customer was getting one initial connection (after being offline for 24 hours). Then all subsequent connections would fail. Have you seen this happening?

viewtopic.php?f=60&t=149970&hilit=Some+error+occured&start=15

mikeysklar
 
Posts: 734
Joined: Mon Aug 01, 2016 8:10 pm

Re: PyPortal Invalid Syntax

by slowjim on Mon Feb 10, 2020 10:02 pm

Hi

I don't think this has been a problem for me. I don't seem to have any issues connecting whenever it tries, in fact I have been very impressed with the boards ability to quickly pick my home wifi. This is really cool. The problems seem to occur after it connects and draws to fetch the information.

Cheers

James

slowjim
 
Posts: 18
Joined: Fri Sep 27, 2019 3:49 am

Re: PyPortal Invalid Syntax

by mikeysklar on Tue Feb 11, 2020 2:31 pm

I do see other mentions in the forums around the JSON_GET_URL timing or failing out like the errors you are seeing in code.py line 46.

viewtopic.php?f=60&t=159594&p=785841&hilit=JSON_GET_URL#p785841

Maybe you can try the demo code Brubell links to in the above thread off github?

mikeysklar
 
Posts: 734
Joined: Mon Aug 01, 2016 8:10 pm

Re: PyPortal Invalid Syntax

by slowjim on Wed Feb 12, 2020 3:44 am

Hi mikeysklar

Thanks for the tip. I ran the code and it seems to have executed as expected. The dates seems a bit weird though. Here is the extract from the REPL:

Connected to XXXXXXXXXX RSSI: -76
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
----------------------------------------
Text Response: This is a test of Adafruit WiFi!
If you can read this, its working :)

----------------------------------------
Fetching JSON data from http://httpbin.org/get
----------------------------------------
JSON Response: {'url': 'http://httpbin.org/get', 'headers': {'User-Agent': 'Adafruit CircuitPython', 'Host': 'httpbin.org', 'X-Amzn-Trace-Id': 'Root=1-5e43ab94-583b35a926a34ac2ea76f9c2'}, 'args': {}, 'origin': '144.132.40.83'}
----------------------------------------
POSTing data to http://httpbin.org/post: 31F
----------------------------------------
Data received from server: 31F
----------------------------------------
POSTing data to http://httpbin.org/post: {'Date': 'July 25, 2019'}
----------------------------------------
JSON Data received from server: {'Date': 'July 25, 2019'}
----------------------------------------

Code done running. Waiting for reload.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.0.0-beta.5 on 2020-02-05; Adafruit PyPortal Titano with samd51j20


Cheers

James

slowjim
 
Posts: 18
Joined: Fri Sep 27, 2019 3:49 am

Re: PyPortal Invalid Syntax

by mikeysklar on Thu Feb 13, 2020 10:06 pm

Did you try both examples? What did the ADVANCED version look like?

https://github.com/adafruit/Adafruit_Ci ... dvanced.py

mikeysklar
 
Posts: 734
Joined: Mon Aug 01, 2016 8:10 pm

Re: PyPortal Invalid Syntax

by slowjim on Thu Feb 13, 2020 10:45 pm

Hi mikeysklar

Sorry, I missed the advance one, I've just tired it. This is the output:

code.py output:
Connecting to AP...
Connected to ajf RSSI: -76
Fetching JSON data from http://httpbin.org/get...
------------------------------------------------------------
Response's Custom User-Agent Header: Adafruit CircuitPython,blinka/1.0.0
------------------------------------------------------------
Response HTTP Status Code: 200
------------------------------------------------------------
Raw Response: b'{\n "args": {}, \n "headers": {\n "Host": "httpbin.org", \n "User-Agent": "Adafruit CircuitPython,blinka/1.0.0", \n "X-Amzn-Trace-Id": "Root=1-5e460907-ab88d36e306383e8ba1c8db0"\n }, \n "origin": "144.132.40.83", \n "url": "http://httpbin.org/get"\n}\n'

Cheers

James

slowjim
 
Posts: 18
Joined: Fri Sep 27, 2019 3:49 am

Re: PyPortal Invalid Syntax

by mikeysklar on Mon Feb 17, 2020 10:37 pm

This response looks perfect as in everything is on-line and functioning.

mikeysklar
 
Posts: 734
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.