Created
November 22, 2021 20:51
-
-
Save hyperlogic/e1b2c1070cdccce854bf8694dfd8e9c0 to your computer and use it in GitHub Desktop.
ready player me render API test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a support video call channel for TribeXR users to join via the vr client or via the web. | |
import requests | |
from requests.adapters import HTTPAdapter | |
from requests.packages.urllib3.util.retry import Retry | |
import json | |
from urllib.parse import urlencode, quote_plus | |
import webbrowser | |
import time | |
import signal | |
# retry http requests on timeouts or if server errors are encountered. | |
retry_strategy = Retry(total=5, | |
status_forcelist=[429, 500, 502, 503, 504], | |
method_whitelist=["HEAD", "GET", "OPTIONS"], | |
backoff_factor=1) | |
adapter = HTTPAdapter(max_retries=retry_strategy) | |
http = requests.Session() | |
http.mount("https://", adapter) | |
http.mount("http://", adapter) | |
DEBUG = True | |
VERBOSE = True | |
# turn base_url and a map of url arguments into a url. | |
def compose_url(base_url, params): | |
# return base_url + "&".join(["{0}={1}".format(k, v) for k, v in params.items()]) | |
return base_url + "?" + urlencode(params, quote_via=quote_plus) | |
# make request and return parsed json response | |
def make_request_post(url, json): | |
if DEBUG: | |
print("make_request, url = " + url) | |
r = http.post(url, json=json, timeout=60.0) | |
if r.status_code == 200: | |
if DEBUG and VERBOSE: | |
print("response = " + r.text) | |
else: | |
print("ERROR: url = {0}, status_code = {1}".format(url, r.status_code)) | |
URL = "https://render.readyplayer.me/render" | |
make_request_post(URL, { | |
"model": "https://d1a370nemizbjq.cloudfront.net/de0cdca1-1db5-4908-a5c3-456aa060c841.glb", | |
"scene": "halfbody-portrait-v1" | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment