버전

menu_open

Python - HTTP

Initializing the project

Note.gif
Note: This example requires Python pip to be installed.

Run the following command from any directory to install dependencies:

pip install requests

Project Code

Locate the sample file <Wwise installation path>/SDK/samples/WwiseAuthoringAPI/python/hello-wwise-wamp/main.py.

This file contains the following code, which allows you to connect to the Wwise Authoring API.

import sys
import os

import requests
import json
import codecs

sys.path.append(os.path.join(os.path.dirname(__file__), '../../../../include/AK/WwiseAuthoringAPI/py'))
from waapi import WAAPI_URI


payload = {
    'uri': WAAPI_URI.ak_wwise_core_getinfo,
    'options': {},
    'args': {}
}

try:
    r = requests.post("http://localhost:8090/waapi", data=json.dumps(payload))
    print(r.status_code, r.reason)
    print(r.text.encode('utf8', 'replace'))
except:
    print("Unable to connect to Waapi: Is Wwise running and Wwise Authoring API enabled?")
Note.gif

Note: The line from waapi import WAAPI_URI imports a declaration of the API paths.

It is located in <Wwise installation path>/SDK/include/AK/WwiseAuthoringAPI/py. The location of this file was added to Python's path dynamically by extending sys.path in this sample.

Running the project

Run the sample file from its directory using the following command:

python main.py

If the Wwise Authoring API successfully connects to Wwise, you should see the following output:

(200, 'OK')
{
  "platform":"x64",
  "displayName":"Wwise",
  "branch":"wwise_main",
  "copyright":"Š 2006-2017. Audiokinetic Inc. All rights reserved.",
  "version":{
    "displayName":"v20??.?.?",
    "year":2017,"build":????,
    "major":1,"schema":??,
    "nickname":"",
    "minor":0
  },
  "directories":{
    "log":"C:\\Program Files (x86)\\Audiokinetic\\Wwise 20??.?.?\\Authoring\\x64\\Release\\bin\\Logs\\",
    "install":"C:\\Program Files (x86)\\Audiokinetic\\Wwise 20??.?.?\\",
    "help":"C:\\Program Files (x86)\\Audiokinetic\\Wwise 20??.?.?\\Authoring\\Help\\",
    "authoring":"C:\\Program Files (x86)\\Audiokinetic\\Wwise 20??.?.?\\Authoring\\",
    "user":"C:\\Users\\(USERNAME)\\AppData\\Roaming\\Audiokinetic\\Wwise\\",
    "bin":"C:\\Program Files (x86)\\Audiokinetic\\Wwise 20??.?.?\\Authoring\\x64\\Release\\bin\\"
  },
  "apiVersion":1,
  "isCommandLine":false,
  "configuration":"release"
}
Note.gif
Note: The information retrieved from Wwise will vary based on your installation.

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요