I will write in Japanese, but please do not move from the "API and Scripts" forum!!
@obatake5TC3R さん こんにちは
pythonで試してみました。
from .modules import requests
が外部ライブラリの読み込みなのですが、素のFusion360ではインストール
されていない為、動かないようです。
標準ライブラリで書き換えた所、動きました。
(元のコードはアドインでしたが、書き換えたものはスクリプトです)
#Fusion360API python script
import adsk.core, adsk.fusion, traceback
import json
import urllib.request
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
userId = app.userId
appId ="1006119760063675415"
url = "https://apps.exchange.autodesk.com/webservices/checkentitlement" + "?userid=" + userId + "&appid=" + appId
response = urllib.request.urlopen(url)
html = response.read()
resp_dict = json.loads(html)
val = resp_dict.get('IsValid')
if val:
ui.messageBox("IsValid is True")
else:
ui.messageBox("IsValid is False")
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
試してはいますが、対象となるアドインのライセンス?が無いので、
常に "IsValid is False" が返って来てしまい、正しい動作なのか? 不明なのが本音です。
結論から言えば、"url" に代入されているフォーマットでアクセスしてDLすると
必要となる情報をJSONフォーマットで落としてくるので、その後は
”自力で頑張れ!” との事の様です。