Skip to content

Commit

Permalink
replace request module with curl and subprocess (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjelev authored Feb 11, 2024
1 parent 0b99e04 commit ad286ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
paho-mqtt==1.6.1
requests
paho-mqtt==1.6.1
7 changes: 3 additions & 4 deletions src/rpi-cpu2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import threading
import update
import config
import requests

# get device host name - used in mqtt topic
hostname = socket.gethostname()
Expand Down Expand Up @@ -214,10 +213,11 @@ def print_measured_values( cpu_load=0, cpu_temp=0, used_space=0, voltage=0, sys_




def get_release_notes():
url = "https://api.github.com/repos/hjelev/rpi-mqtt-monitor/releases/latest"
response = requests.get(url)
data = json.loads(response.text)
response = subprocess.run(['curl', '-s', url], capture_output=True)
data = json.loads(response.stdout)
release_notes = data["body"]

lines = release_notes.split('\n')
Expand All @@ -234,7 +234,6 @@ def get_release_notes():
if len(release_notes) > 255:
release_notes = release_notes[:250] + " ..."

print(release_notes, len(release_notes))
return release_notes

def config_json(what_config):
Expand Down

0 comments on commit ad286ad

Please sign in to comment.