replace request module with curl and subprocess (#85)
This commit is contained in:
@@ -1,2 +1 @@
|
|||||||
paho-mqtt==1.6.1
|
paho-mqtt==1.6.1
|
||||||
requests
|
|
||||||
@@ -16,7 +16,6 @@ import argparse
|
|||||||
import threading
|
import threading
|
||||||
import update
|
import update
|
||||||
import config
|
import config
|
||||||
import requests
|
|
||||||
|
|
||||||
# get device host name - used in mqtt topic
|
# get device host name - used in mqtt topic
|
||||||
hostname = socket.gethostname()
|
hostname = socket.gethostname()
|
||||||
@@ -214,10 +213,11 @@ def print_measured_values( cpu_load=0, cpu_temp=0, used_space=0, voltage=0, sys_
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_release_notes():
|
def get_release_notes():
|
||||||
url = "https://api.github.com/repos/hjelev/rpi-mqtt-monitor/releases/latest"
|
url = "https://api.github.com/repos/hjelev/rpi-mqtt-monitor/releases/latest"
|
||||||
response = requests.get(url)
|
response = subprocess.run(['curl', '-s', url], capture_output=True)
|
||||||
data = json.loads(response.text)
|
data = json.loads(response.stdout)
|
||||||
release_notes = data["body"]
|
release_notes = data["body"]
|
||||||
|
|
||||||
lines = release_notes.split('\n')
|
lines = release_notes.split('\n')
|
||||||
@@ -234,7 +234,6 @@ def get_release_notes():
|
|||||||
if len(release_notes) > 255:
|
if len(release_notes) > 255:
|
||||||
release_notes = release_notes[:250] + " ..."
|
release_notes = release_notes[:250] + " ..."
|
||||||
|
|
||||||
print(release_notes, len(release_notes))
|
|
||||||
return release_notes
|
return release_notes
|
||||||
|
|
||||||
def config_json(what_config):
|
def config_json(what_config):
|
||||||
|
|||||||
Reference in New Issue
Block a user