firebase - Returning 404 on python script https problems? -
i have of app running smoothly trying python code send serial data through 404 when try use python3 issues serialutil far basestring not being defined etc etc in serial libraries. revert python 2.7 , wondering if possible add https string somewhere override whatever happening reverting http?
import serial import time import requests import json firebase_url = 'https://ourfleet.firebaseio.com' auth_token = '0sbnzjz4uqvltedogsajsksdksdbnasasjsdl' #connect serial port communication ser = serial.serial('/dev/tty.wchusbserial410', 9600, timeout=0) #setup loop send gps values @ fixed intervals #in seconds fixed_interval = 10 while 1: try: #gps value obtained arduino + ublox gps_c = ser.readline() #current time , date time_hhmmss = time.strftime('%h:%m:%s') date_mmddyyyy = time.strftime('%d/%m/%y') #current location name gps_location = 'ourfleet' print (gps_c + ',' + time_hhmmss + ',' + date_mmddyyyy + ',' + gps_location) #insert record data = {'date':date_mmddyyyy,'time':time_hhmmss,'location':gps_c} result = requests.post('https://ourfleet.firebaseio.com' + '/' + gps_location + '/gps_c.json'+ auth_token, data=json.dumps(data)) #insert record print ('record inserted. result code = ' + str(result.status_code) + ',' + result.text) time.sleep(fixed_interval) except ioerror: print('error! went wrong.') time.sleep(fixed_interval)
Comments
Post a Comment