Difference between revisions of "Python"

From truxwiki.com
Jump to navigation Jump to search
Line 55: Line 55:
 
* [[TruxtonETL]] - For becoming a Truxton [https://en.wikipedia.org/wiki/Extract,_transform,_load ETL] process.
 
* [[TruxtonETL]] - For becoming a Truxton [https://en.wikipedia.org/wiki/Extract,_transform,_load ETL] process.
 
* [[TruxtonEvent]] - For adding records to the <code><nowiki>[</nowiki>[[Event Table|Event]]<nowiki>]</nowiki></code> table.
 
* [[TruxtonEvent]] - For adding records to the <code><nowiki>[</nowiki>[[Event Table|Event]]<nowiki>]</nowiki></code> table.
* [[TruxtonEventType]] - For adding custom event types to Truxton.
+
* [[TruxtonEventType]] - For adding custom event types to Truxton. This will make an entry in the <code>[EventType]</code> table.
 
* [[TruxtonExport]] - For exporting files out of Truxton.
 
* [[TruxtonExport]] - For exporting files out of Truxton.
 
* [[TruxtonEXIF]] - For adding records to the <code><nowiki>[</nowiki>[[EXIF Table|EXIF]]<nowiki>]</nowiki></code> table.
 
* [[TruxtonEXIF]] - For adding records to the <code><nowiki>[</nowiki>[[EXIF Table|EXIF]]<nowiki>]</nowiki></code> table.
 
* [[TruxtonFileIO]] - For working with a read-only file stored in Truxton.
 
* [[TruxtonFileIO]] - For working with a read-only file stored in Truxton.
* [[TruxtonFileType]] - For adding new file types to Truxton.
+
* [[TruxtonFileType]] - For adding new file types to Truxton. This will make an entry in the <code>[FileType]</code> table.
* [[TruxtonInvestigation]] - For creating new investigations in Truxton.
+
* [[TruxtonInvestigation]] - For creating new investigations in Truxton. This will make an entry in the <code>[Investigation]</code> table.
* [[TruxtonJurisdiction]] - For creating new jurisdictions in Truxton.
+
* [[TruxtonJurisdiction]] - For creating new jurisdictions in Truxton. This will make an entry in the <code>[Jurisdiction]</code> table.
 
* [[TruxtonLocation]] - For adding geographic coordinates to the <code><nowiki>[</nowiki>[[Location Table|Location]]<nowiki>]</nowiki></code> table.
 
* [[TruxtonLocation]] - For adding geographic coordinates to the <code><nowiki>[</nowiki>[[Location Table|Location]]<nowiki>]</nowiki></code> table.
* [[TruxtonMedia]] - For adding media to Truxton.
+
* [[TruxtonMedia]] - For adding media to Truxton. This will make an entry in the <code>[Media]</code> table.
 
* [[TruxtonMessage]] - The way Truxton [https://en.wikipedia.org/wiki/Extract,_transform,_load ETL] processes communicate.
 
* [[TruxtonMessage]] - The way Truxton [https://en.wikipedia.org/wiki/Extract,_transform,_load ETL] processes communicate.
 
* [[TruxtonObject]] - The object responsible for a connection to Truxton.
 
* [[TruxtonObject]] - The object responsible for a connection to Truxton.
* [[TruxtonOptions]] - The object responsible for retrieving configuration variables.
+
* [[TruxtonOptions]] - The object responsible for retrieving configuration variables from Truxton's [[Configuration System]].
 
* [[TruxtonRelation]] - For adding records to the <code><nowiki>[</nowiki>[[Relation Table|Relation]]<nowiki>]</nowiki></code> table for relating two items in Truxton.
 
* [[TruxtonRelation]] - For adding records to the <code><nowiki>[</nowiki>[[Relation Table|Relation]]<nowiki>]</nowiki></code> table for relating two items in Truxton.
* [[TruxtonSubject]] - For adding subjects of investigations, aka persons of interest, aka suspects.
+
* [[TruxtonSubject]] - For adding subjects of investigations, aka persons of interest, aka suspects. This will make an entry in the <code>[Suspect]</code> table.
 
* [[TruxtonUrl]] - For adding records to the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table.
 
* [[TruxtonUrl]] - For adding records to the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table.
 
* [[TruxtonUSB]] - For adding records to the <code><nowiki>[</nowiki>[[USBDevice Table|USBDevice]]<nowiki>]</nowiki></code> table.
 
* [[TruxtonUSB]] - For adding records to the <code><nowiki>[</nowiki>[[USBDevice Table|USBDevice]]<nowiki>]</nowiki></code> table.

Revision as of 12:14, 26 January 2021

Truxton supports Python 3.8 via the Truxton.pyd library.

Overview

You must use the "import" directive to load this. Go to the C:\Program Files\Truxton\SDK folder and start Python.

import truxton

When you import truxton you will get all of the predefined constants for file type, data type, origins, locations, messages, entities, relations, events, media, objects, url methods, and urls. You can see them all by issuing a dir command.

>>> dir(truxton)

This will allow your Python code to use the same constant names as C, C++ and C# code.

>>> print(truxton.Type_JPEG)
203

Once you have this working, you can start playing with Truxton.

import truxton

def main():
  t = truxton.create()
  print(t.version)

if __name__ == "__main__":
  main()

You can create a folder for your project, copy the SDK contents into it and work from there.

Style

In general, when using a Truxton Python object, you will follow this pattern:

  1. Create the object
  2. Set the data members of the object
  3. Call save() to store the object in the Truxton database.

Until you call save(), nothing will appear in Truxton.

Classes

Truxton exposes several classes to Python.

Remarks

The Python API is designed primarily for programs to contribute to Truxton.

Truxton.pyd was developed using the C API with a thin adapter layer of code to translate from Python provider semantics to Truxton calls.

Samples