0

Attribute error using .fetch()
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Attribute error using .fetch()

by rgall on Thu Feb 18, 2021 8:13 am

Hi

I trying to retrieve some text from the follow website.
https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&TABLE_TYPE=OBSERVER&QUANTITIES=%274%27&COMMAND=%224%22&SOLAR_ELONG=%220%2C180%22&LHA_CUTOFF=0&CSV_FORMAT=YES&CAL_FORMAT=BOTH&ANG_FORMAT=DEG&APPARENT=AIRLESS&REF_SYSTEM=J2000&EXTRA_PREC=NO&CENTER=coord%40399&COORD_TYPE=GEODETIC&SITE_COORD=%27-63.131100%2C46.238200%2C0.060000%27

I set up the the following Json_path = [0, 'text']
and issuing command : magtag.fetch()
gets the following errors
Code: Select all | TOGGLE FULL SIZE
Retrieving data...Traceback (most recent call last):
  File "code.py", line 27, in <module>
  File "magtag.py", line 355, in fetch
  File "adafruit_magtag/network.py", line 464, in fetch_data
  File "adafruit_magtag/network.py", line 436, in fetch
  File "adafruit_requests.py", line 594, in get
  File "adafruit_requests.py", line 551, in request
  File "adafruit_requests.py", line 546, in request
AttributeError: 'NoneType' object has no attribute 'split'


Any ideas how I can work around the problem?
Is there a way I can use the fetch command just to download raw bytes

Thanks for the help.

Rod

rgall
 
Posts: 13
Joined: Mon Dec 05, 2016 10:46 am

Re: Attribute error using .fetch()

by tannewt on Thu Feb 18, 2021 3:33 pm

The first step is usually to make sure you are using the latest libraries. We tend to fix bugs pretty quickly.

I don't think there is an easy work around. Requests is usually as low as you want to go because it handles HTTP.

tannewt
 
Posts: 2189
Joined: Thu Oct 06, 2016 8:48 pm

Re: Attribute error using .fetch()

by rgall on Fri Feb 19, 2021 6:06 pm

I got a good response from using:

response=magtag.network.requests.get(url)

Possible issue with the fetch command is it nor expecting null characters in the response.

I updated my libraries to current version and now have a rat nest of dependancy issues (new Post) and I am dead in the water until resolved as I did not save the old version before testing

Anywhere to find old library versions

Thanks for the help.

rgall
 
Posts: 13
Joined: Mon Dec 05, 2016 10:46 am

Please be positive and constructive with your questions and comments.