I'm trying to connect Python and Pingbong Builder, but I have no idea, so I'm asking you a question.
From Pingpong Builder's side, https://docs.builder.pingpong.us/integration/custom This and the code below
curl -X POST \
-H "Authorization: Basic a2V5OjRlYzg4MDBiOWIwMGRjOTBkODc3NGYwMDk2YTMzNmNl" \
-H "Content-Type:application/json" \
-d "{\"request\":{\"query\": \"Hello\"}}"\
https://builder.pingpong.us/api/builder/5ebe0072e4b0e921afb5c210/integration/v0.2/custom/{sessionId}
I gave it as an example, but I don't understand. Please let me know if you know.
python
The above example is used to send a request as a curl function in Linux, and if you transcribe the same action to Python, it is shown below.
import requests
# 1. Header Settings
header = {
'Authorization': 'Basica2V5OjRlYzg4MDBiOWIwMGRjOTBkODc3NGYwMDk2YTMzNmNl', # I should write down my authentication key, right?
'Content-Type': "application/json",
}
# 2. Request Body Settings
param = {
"request":{
"query": "Hello"
}
}
# 3. Address setting
SessionId = "mySessionId" # Please write your own SessionId
url = 'https://builder.pingpong.us/api/builder/5ebe0072e4b0e921afb5c210/integration/v0.2/custom/' + sessionId
# End of setup Send Request
req = requests.post(url, data=param, headers=header)
# To check Response
data = req.json()
print(data)
580 GDB gets version error when attempting to debug with the Presense SDK (IDE)
572 Uncaught (inpromise) Error on Electron: An object could not be cloned
558 Who developed the "avformat-59.dll" that comes with FFmpeg?
565 PHP ssh2_scp_send fails to send files as intended
559 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.