You can't use it in browser because you need to provide "Accept" header in the request.
Actually you can, and yess it matters in windows if it is installed on the C: drive instead of the F: http://192.168.2.41:8082/api/positions
0
id 1747
attributes
batteryLevel 72
distance 126.98
totalDistance 86500.71
ip "xx.xx.xx.xx"
motion true
deviceId 1
type
protocol "osmand"
serverTime
deviceTime "2017-08-29T09:20:19.000+0000"
fixTime "2017-08-29T09:20:19.000+0000"
outdated false
valid true
latitude 4xxx
longitude -7xxx
altitude 307.5769816430143
speed 3.0189843284740445
course 284.8475646972656
address "somewhere, ON, CA"
accuracy 0
network
It definitely has nothing to do with drive. If Accept header is not provided, server can randomly decide what format to use, so it can work intermittently.
Ok, how do I prevent that? The api uses positions and when I could not get to it from the web address it was not reporting back to the script, as soon as I could use the address bar then it started reporting back to the script. Unfortunately I had the same or similar isssues when I was using the demo server, not reporting back to the script.
As I said earlier, you need to provide Accept header in your request.
are you talking about the address bar or the script? It has been almost twenty years since I programmed and a lot has changed since then!
I am talking about script. I don't think you can add a header in browser, unless you use some extension.
So I may not pull out any more of my hair, this portion of the script does the get but I see no Accept in it. Could that be the reason why sometimes it works and other times not? It is part of a python script that is only 74 lines long used within home assistant.
def _update_info(self, now=None) -> None:
"""Update the device info."""
_LOGGER.debug('Updating devices %s', now)
self._devices = requests.get(self._host + '/api/devices', auth=(self._username, self._password))
self._device_data = json.loads(self._devices.text)
self._positions = requests.get(self._host + '/api/positions', auth=(self._username, self._password))
self._positions_data = json.loads(self._positions.text)
for dev_id in self._device_data:
Well, if it's not there it doesn't mean it can't be added:
http://docs.python-requests.org/en/master/user/quickstart/#custom-headers
You need to add "Accept" header with "application/json" as value.
I cannot get this to work reliably. It must have worked before as the script was working but now not so much. entering the address bar/api/positions does not work error of file not found.
Can installing to another drive other than C: cause this?