From da046a346819d733d85b5c5f6c0ea4cda86c4c83 Mon Sep 17 00:00:00 2001 From: lasers Date: Mon, 23 Dec 2024 19:02:11 -0600 Subject: [PATCH] getjson: fix examples --- py3status/modules/getjson.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/py3status/modules/getjson.py b/py3status/modules/getjson.py index 6f07418e57..1d6c6fa90e 100644 --- a/py3status/modules/getjson.py +++ b/py3status/modules/getjson.py @@ -29,20 +29,28 @@ Examples: ``` # straightforward key replacement -url = 'http://ip-api.com/json' -format = '{lat}, {lon}' +getjson { + url = "https://ifconfig.co/json" + format = "{latitude}, {longitude}" +} # access child objects -url = 'https://api.icndb.com/jokes/random' -format = '{value-joke}' +getjson { + url = 'https://api.icndb.com/jokes/random' + format = '{value-joke}' +} # access title from 0th element of articles list -url = 'https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey={KEY}' -format = '{articles-0-title}' +getjson { + url = 'https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey={KEY}' + format = '{articles-0-title}' +} # access if top-level object is a list -url = 'https://jsonplaceholder.typicode.com/posts/1/comments' -format = '{0-name}' +getjson { + url = 'https://jsonplaceholder.typicode.com/posts/1/comments' + format = '{0-name}' +} ``` @author vicyap