This is a demo web app that demonstrates how to create an APS Model Viewer using the Reflex framework using only Python.
The project leverages APS endpoints to retrieve a three-legged token.
-
Clone the project
-
Create an app on aps.autodesk.com
-
Copy the Client Id and the Client Secret and Redirect URL in a
.env
file and add it to the project in the same folder whereaps.py
is located.The
.env
file should look like this:CONSUMER_KEY=<Client Id>
CONSUMER_SECRET=<Client Secret>
REDIRECT_URI=<Redirect Url>
-
Create a virtual environment and install the dependencies (e.g.,
pip install -r requirements.txt
) -
From the terminal in the project folder launch
reflex init
to initialize the reflex project and select a blank template -
When completed launch reflex run and wait until you receive confirmation that the app is running
-
Open the browser and navigate to
http://localhost:3000
to see the app -
Press on the menu icon on the top right corner and select the
Log In
option to authenticate your Autodesk account
- You can pass a different derivatives urn in the
shared_reflex_viewer.py
as an argument of thecreate_viewer()
function.
If the viewer does not load, chances are the token needs to be refreshed.
Try to close al the browser windows to clean the cache and authenticate again.
Copyright (c) 2024 Autodesk, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- reflex 0.4+
- python-decouple
- requests
- Paolo Serra (Autodesk)
- Martin Xu (Reflex)