Package: weclapp-cli
WECLAPP CLIweclapp-cliis a limited command line interface toweclapp's time records. I wrote this
tool because I want to upload several time records at once that have been stored in an Excel
sheet. The web interface allows you to upload a time record once at a time and when you have
several time records to upload, this can take a lot of time.FeaturesDisplay the projects and the project tasks (with their respective IDs) for which you can
book time recordsDisplay the time records that you have already bookedUpload time records from a CSV fileAllows to use a custom CSV exporterInstallationNoteAs of this moment, the project is still in development and has not been uploaded toPyPIyet, so thepipcommand will fail.pipinstallweclapp-cliRequirementPython3.xUsageIn order to have access to weclapp's public API, you need aAPI Token. You can get your
API Token from theMy settingspage of your weclapp installation. If you don't have an API
Token yet, then click onCreate new API tokento generate a new one. Please think of your
API Token as a password, keep it secret!Configuring the clientweclapp-clineeds to be configured before you can start using it.
The default configuration path is${HOME}/.config/weclapp-cli/config.yml.You'll need the following values:the domain of you weclapp installation, usuallyyourcomapny.weclapp.comthe API path, usually/webapp/api/v1your API TokenAlso check whether you have to access the API via HTTPS. Once you have all these values,
open a terminal and type in:$weclapp-cliconfig
Generatinganewconfigurationfile/home/shaoran/.config/weclapp-cli/config.yml
Yourweclappdomain[]:yourcomapny.weclapp.com<ENTER>
TheAPIpath[/webapp/api/v1]:<ENTER>
YourAPITOKEN[]:YOUR-TOKEN<ENTER>
UseSSL[yes]:<ENTER>List projects, tasks and the last 100 time records$weclapp-cliprojectsList projects, tasks only$weclapp-cliprojects-tUploading time recordsPrepare the CSV file, then execute$weclapp-cliuploadmy-records.csvTo get the options (like the separator character) for the default parse, execute$weclapp-cliupload--list-parser-optionsYou can pass these option with the--po KEY=VALoption.The CSV fileIn order to upload a time record, you'll need to store your time records in a CSV-like file.I store my time records in an Excel sheet that has the following format:NOTEDo not add empty lines and lines with comments (usually lines beginning with#).The headerThe first 2 rows are the header. It contains the project ID and the task ID for which you want
to upload your time records.In the example above the cellsA1andA2are ignored, you can have any string you like.The next two columns (BandC) define the task for which you want to upload time records. The next
two columns (DandE) define another task, etc. You can have as many tasks as you want. For every
task you need two columns. In the example aboveB1andB2have the project ID and the task ID for the
first task.D1andD2have the project ID and the task ID for the next task.The time recordsFrom the third row onward you'll define the time records. On theAcolumn set the date of the day. The next
cell contains the number of hours you've worked on the project and the next column is the description of
the time record. The description may be empty. The next column is for the next number of hours and so on.The date colum (A) is parsed usingdateutil.parser.parse, so you can have different date formats,
for example:Thursday, 01/Feb2019.02.0102-01-2019are recognized as1st of February 2019. If you omit the year, the current year is assumed.By default the time of day of the records is 09:00. You can set another time by passing the--po timeStart 08:00option toweclapp-cli uploadcommand. You have to use the 24 hour format.If you need that a single entry has a different time of day than the default: instead of just passing
the duration (number of hours) as single number, you can passtime/duration. For example: you want
a single entry in theBcolumn to have a time of day of 08:30 with a duration of 3 hours. Then enter the
value08:30/5.00. Here you have to use the 24 hour format as well.The default CSV will ignore time record that have an empty duration, in the image aboveD5is empty, so
that time record is ignored. The description can always be empty.ExampleThe resulting CSV file from the image above would bePROJECT ID;12345;;323234;
TASK ID;6789;;11232;
Tuesday, 01/ Jan;;;;
Wednesday, 02/ Jan;4.00;some desc;4.00;something else
Thursday, 03/ Jan;8.00;;;
Friday, 04/ Jan;3.00;;5.00;wiki stuff
Saturday, 05/ Jan;;;;
Friday, 11/ Jan;;;;Custom CSV filesIf you want to use a different CSV parser, then you can write your own and letweclapp-cliuse it
instead of the default one.Create a filecsv_exporter.pyin the same directory where the configuration file is stored
(by default in${HOME}/.config/weclapp-cli).# ${HOME}/.config/weclapp-cli/csv_exporter.pyfromweclappimportParserclassMyCustomCSV(Parser):"""implement your parser here"""passparsers=[{"name":"custom","parser":MyCustomCSV},]Thecsv_exporter.pyfilemusthave a variable calledparsers. This variable is used byweclapp-clito import your custom parser. And since it is a list, youcanexport more than
one custom parser. If you want to mark a custom parser as the new default, then add"default": Trueparsers = [
    { "name": "matrix", "parser": MyCustomCSV, "default": True },
]To display the list of parsers, execute$weclapp-cliupload-l
csv
matrixThe first entry is the default parser.To use the "matrix" parser:$weclapp-cliupload-pmatrixfile.csvSeeCustom Parsersfor information about custom parsersContributionsI don't intend to keep adding features, because it already does everythingIneed. But hey,
this is a open source project, so you are welcome to fork it. If you have bug fixes, new features
or new parsers, then please send me pull request.DisclaimerI do not own, developweclappand don't claim any copyright. weclapp is a product owned and
developed byweclapp GmbH. Any questions you have about weclapp, please go their websitehttps://www.weclapp.com/, don't ask me.Use this tool at your own risk, I am not responsible for any data losses or damages
as a result of using this tool.LICENSE: GPL-2