-1

I use Airplay with a Raspberry Pi, so I installed Sharply-sync. It work perfectly but I want to control the music of my iPhone which is emitting music with airplay. I saw this page to do this: http://nto.github.io/AirPlay.html#audio-remotecontrol

So I have to make an HTTP request to control the music, but I don't know how to use this: GET /ctrl-int/1/pause HTTP/1.1 Host: starlight.local. Active-Remote: 1986535575 How can I make a request ( why not in Python :) ) with that ?

My raspberry informations: IP: 192.168.X.XX The Port: 5000 Active-Remote: 1075873687 (It's an example because it change every Time)

I know the first part of the url which I have to make the request, I think it's: http://192.168.X.XX:5000//ctrl-int/1/pause but I don't know how to put the rest...

How can I do that PLEASE ?

Thank for your answers and I'm so sorry for my bad English..

A.Moret
  • 43
  • 3

1 Answers1

0

Just use requests module. Check sample code below.

import requests
headers = {'Host': 'starlight.local.' , 'Active-Remote': 1986535575}
url = "http://192.168.x.xx:5000//ctrl-int/1/pause"
requests.get(url, headers=headers)

For more details please check the documentation for the module at http://docs.python-requests.org/en/master/.

Anchit Jain
  • 181
  • 2
  • 14
  • Okay thank you for your post !!! I test that but no responses... The request load indefinitely, I know it's the port 5000 because I did a nmap to scan ports and it's the only one with the 80 and the 22. So what is the problem ? Why it doesn't work and how to make work that ? – A.Moret Jul 03 '16 at 22:30
  • Can't say definitely without other details. Could you please check that you could open that URL using the web browser or curl. In case not then there might be some issue in installation. – Anchit Jain Jul 04 '16 at 06:02
  • When I try to go in the ip address with the port 5000 the web browser is loading to infinity, and it's the same when I try to make a curl command that's loading to infinity.. And I really think it's the port 5000 which I have to use because other ports give me an error like: "Page can't be load" in a web browser – A.Moret Jul 04 '16 at 12:20