PyPortal Invalid Syntax

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
slowjim
 
Posts: 40
Joined: Fri Sep 27, 2019 3:49 am

Re: PyPortal Invalid Syntax

Post by slowjim »

Hi mikeysklar

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

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: PyPortal Invalid Syntax

Post by mikeysklar »

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+ ... d&start=15

User avatar
slowjim
 
Posts: 40
Joined: Fri Sep 27, 2019 3:49 am

Re: PyPortal Invalid Syntax

Post by slowjim »

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

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: PyPortal Invalid Syntax

Post by mikeysklar »

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&hi ... RL#p785841

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

User avatar
slowjim
 
Posts: 40
Joined: Fri Sep 27, 2019 3:49 am

Re: PyPortal Invalid Syntax

Post by slowjim »

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 BANNED 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

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: PyPortal Invalid Syntax

Post by mikeysklar »

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

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

User avatar
slowjim
 
Posts: 40
Joined: Fri Sep 27, 2019 3:49 am

Re: PyPortal Invalid Syntax

Post by slowjim »

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

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: PyPortal Invalid Syntax

Post by mikeysklar »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”