Replies: 2 comments 4 replies
-
Uh, yeah, you are printing a list of class objects. If you read the documentation you will see that you can access these attributes by name: for category in PartCategory.list(api):
print("Name:", category.name) |
Beta Was this translation helpful? Give feedback.
3 replies
-
In Python, you can use the the following to find available fields:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'm trying to use the InvenTree Python API to extract certain fields for parts. For instance, in the screenshot below, I would like to be able to extract the values of fields such as Location, Purchase Order, and Purchase Price.
I am looking through both the general Python API documentation (https://docs.inventree.org/en/latest/api/python/python/) and the
api-doc
. Using the Server Address and Token, I'm able to connect to the InvenTree Server. e.g. through the command:api = InvenTreeAPI(SERVER_ADDRESS, token=MY_TOKEN)
However, I am not able to view any specific fields related to each part, or find out the correct primary key of a part of interest. For example, when attempting to print out the result of the
PartsCategory
command, I get a description of the class (e.g.<class 'inventree.part.PartCategory'><pk=[PN]>
) rather than the part itself.Do you have any suggestions on how I can access specific fields of a part of interest?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions