mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2025-07-06 01:34:14 +00:00
Python branch funkwhale-cli
This commit is contained in:
parent
a336656398
commit
e9a32e96ef
4 changed files with 109 additions and 0 deletions
30
src/fw_api.py
Normal file
30
src/fw_api.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import requests, json, time
|
||||
from loguru import logger
|
||||
|
||||
with open('.auth.json', 'rt') as f:
|
||||
auth = json.loads(f.read())
|
||||
|
||||
instance = 'fw.ponychord.rocks'
|
||||
headers= {
|
||||
"Authorization": "Bearer " + auth.get('fw.ponychord.rocks')
|
||||
}
|
||||
|
||||
def concatinate_endpoint(endpoint):
|
||||
return 'https://' + instance + endpoint
|
||||
|
||||
# [FunkWhale radios]
|
||||
def get_radios():
|
||||
r = requests.get(f'https://{instance}/api/v1/radios/radios/', headers=headers)
|
||||
return r.json()
|
||||
|
||||
|
||||
def post_radio_session(requested_radio):
|
||||
r = requests.post(f'https://{instance}/api/v1/radios/sessions/', json=requested_radio, headers=headers)
|
||||
return r.json()
|
||||
|
||||
|
||||
def get_track_radio(radio_session):
|
||||
r = requests.post(f'https://{instance}/api/v1/radios/tracks/',json=radio_session, headers=headers)
|
||||
return r.json()
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue