Files
muninn/python_scripts/__pycache__/_client.cpython-310.pyc
T

29 lines
2.1 KiB
Plaintext
Raw Normal View History

2026-07-19 17:52:14 +03:00
o
ä\j€ã @srdZddlZddlZddlZddlZddlZddlZdZde fdd„Z
d
de de d e dBd
e dBddf
d d „Z dS)z|Shared HTTP helper for the Muninn API scripts.
Not meant to be run directly - imported by sites.py, accounts.py, posts.py.
éNzhttp://localhost:8001ÚreturncCstj dt¡ d¡S)NÚMUNINN_API_URLú/)ÚosÚenvironÚgetÚDEFAULT_BASE_URLÚrstrip©r
r
ú9/home/liquidsky/Projects/muninn/python_scripts/_client.pyÚbase_urlsr ÚmethodÚpathÚparamsÚbodyc CsÐtƒ›|›�}|rd dd„| ¡Dƒ¡}|r|›d|›�}|dur*t |¡ d¡nd}ddi}|dur8d|d <tjj||||d
�}ztj  |¡�} |  
¡  d¡}
Wdƒn1s[wYWnotj j
y£} z4|  
¡  d¡} zt | ¡}
Wntjy‡d | i}
Ynwttj|
d d
�tjd�t d¡WYd} ~ n2d} ~ wtj jyÐ} z ttjd d|›d| j›�id d
�tjd�t d¡WYd} ~ nd} ~ ww|
rát |
¡}
ttj|
d d
�ƒt d¡dS)z³Call the API and print the JSON response to stdout.
Exits 0 on a 2xx response. On an HTTP error or network failure, prints
a JSON error object to stderr and exits 1.