Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:
- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Python API: 401 Unauthorised when include_mate_connectors set to true in get_assembly_def arguments
anthony_cheung
Member Posts: 6 ✭
https://github.com/onshape-public/python-client/blob/master/docs/AssembliesApi.md#get_assembly_definition
^ I've been using the above code to get the assembly definition but when I set include_mate_connectors in get_assembly_definition call I get a 401 error.
However it works fine if I remove them.
Wondering if anyone could help diagnose this issue. Thanks.
^ I've been using the above code to get the assembly definition but when I set include_mate_connectors in get_assembly_definition call I get a 401 error.
However it works fine if I remove them.
Wondering if anyone could help diagnose this issue. Thanks.
Tagged:
0
Comments
-
Thank you for trying out the experimental python client! I'm happy to help you here, but FYI, I posted an issue against the repo itself to track this issue here: https://github.com/onshape-public/python-client/issues/40
-
Just fixed this -- see here: https://github.com/onshape-public/onshape-clients/blob/master/python/test/test_assemblies_api.py One thing to note is that the inlcude_mate_connectors only actually does everything if you also set the include_features flag.0
-
Apologies I was inaccurate. It was actually if you put in any kwargs. Thanks for the quick fix!0
-
@ethan_keller769
installed onshape-client with pip install (confirmed on 0.0.24)
cloned the onshape-clients repo
pipenv shell in onshape-clients/python then ran my get assembly definition code
and now I'm getting Error 111 Connection Refused.
tried without pipenv --> same error
Let me know if I did something wrong, thanks.0 -
Hmm... what did you plugin for your baseurl in your credentials file? It should be https://cad.onshape.com (without the /api). Specifically, your creds file should look like (of course with your own credentials plugged in):
prod: base_url: "https://cad.onshape.com"
secret_key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
access_key: XXXXXXXXXXXXXX default_stack: prod0 -
In my code I added the second line:
configuration = onshape_client.Configuration() configuration.host = "http://cad.onshape.com"<br>
Fixes the issue 111 error because the URL is correct now. Default configuration.host is set to localhost in configuration.py.
However, now I get a returned None from my API call. Any ideas?
I copied the URL the program uses and it works in my browser.0 -
That is because some of our APIs still don't have typing information migrated to openAPI. You'll need to add the keyword argument
_preload_content=false
0 -
@ethan_keller769 thanks for all the help0
Categories
- All Categories
- 10.2K Community Support
- 4.6K General
- 194 Account and subscriptions
- 353 Data management
- 1.6K Product Feedback
- 215 New in Onshape
- 14 Onshape Labs
- 75 CAM Studio
- 35 PCB Studio
- 107 Simulation
- 209 Onshape Mobile
- 315 App Store & Partners Apps
- 8.2K Using Onshape
- 1.8K Drawings
- 2.3K FeatureScript
- 324 Learning Center
- 253 Education Community

