Skip to content

Set parameters with Python #164

@arthurbreme-cmyk

Description

@arthurbreme-cmyk

Hello,
My Kraken SDR is working well with a Raspberry and the webserver. Now, I would like to control it in a Python script, and I have trouble to set new parameters (e.g. Center Frequency). With json messages, I can get the DOA. I can also get the settings.json file with the script:

import requests
kraken_ip = "10.91.215.241"
url = f"http://{kraken_ip}:8081/settings.json"
response = requests.get(url)
with open("settings.json", "w", encoding="utf-8") as f:
f.write(response.text)
print("settings.json téléchargé !")

I have changed one parameter in the settings.json file, and tried to send it back to the Kraken with these commands:

import requests
kraken_ip = "10.91.215.241"
url = f"http://{kraken_ip}:8081/upload?path=/"
with open("settings.json", "r", encoding="utf-8") as f:
data = f.read()
response = requests.post(url, data=data, headers={"Content-Type": "application/json"})
print("Réponse du Kraken :", response.text)

I get a 404 error message:

Réponse du Kraken : <!doctype html><title>404 Not Found</title><style>
body { background-color: #fcfcfc; color: #333333; margin: 0; padding:0; }
h1 { font-size: 1.5em; font-weight: normal; background-color: #9999cc; min-height:2em; line-height:2em; border-bottom: 1px inset black; margin: 0; }
h1, p { padding-left: 10px; }
code.url { background-color: #eeeeee; font-family:monospace; padding:0 2px;}

Can you please help me understand the problem? Do you have another way to set parameters with Python?
Thank you very much.
Best regards
Arthur

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions