push2HAL is a basic Python library dedicated to data uploading on HAL database. It will use the classical API of HAL to get information and the SWORD one to upload content. Two main executables are provided (for UNIX use only):
pdf2halis able to upload a PDF file to an existing notice on HAL (only with valid permission to modify it).json2halis able to build the necessary data from a JSON file to create a new notice in HAL and upload it directly with or without providing a PDF file.
pdf2hal proposes an interactive mode to upload a PDF to the right/selected notice in HAL by extracting basic data from the PDF file and executing a search on HAL database
usage: pdf2hal [-h] [-a HALID] [-c CREDENTIALS] [-v] [-e] [-l LOGIN] [-p PASSWD] [-f] pdf_path
-
positional argument:
pdf_pathPath to the PDF file -
optional arguments:
| short | long | default | help |
|---|---|---|---|
-h |
--help |
show this help message and exit | |
-a |
--halid |
None |
HALid of document to update |
-c |
--credentials |
None |
Path to the credentials file |
-v |
--verbose |
Show all logs | |
-e |
--prod |
Execute on production server (use with caution) | |
-t |
--test |
Execute on prod server as test (dryrun) | |
-l |
--login |
None |
Username for API (HAL) |
-p |
--passwd |
None |
Password for API (HAL) |
-cc |
--complete |
None |
Run completion (use grobid, idext or affiliation or list of terms separated by comma) |
-id |
--idhal |
None |
idHal to link deposit to specific user |
json2hal is able to create a note on HAL based on content provided in a JSON file. Additional (PDF) could be provided and uploaded on the same time
usage: json2hal [-h] [-c CREDENTIALS] [-v] [-e] [-t] [-l LOGIN] [-p PASSWD] [-cc COMPLETE] [-id IDHAL] json_path
-
positional argument:
json_pathPath to the JSON file -
optional arguments:
| short | long | default | help |
|---|---|---|---|
-h |
--help |
show this help message and exit | |
-c |
--credentials |
None |
Path to the credentials file |
-v |
--verbose |
Show all logs | |
-e |
--prod |
Execute on production server (use with caution) | |
-t |
--test |
Execute on prod server as test (dryrun) | |
-l |
--login |
None |
Username for API (HAL) |
-p |
--passwd |
None |
Password for API (HAL) |
-cc |
--complete |
None |
Run completion (use grobid, idext or affiliation or list of terms separated by comma) |
-id |
--idhal |
None |
idHal to link deposit to specific user |
- HAL credentials (for production or pre-production server) could be provided using
.apihalbased on JSON syntax (see.apihal_example) - by default, the preprod server is used (argument
-euse the production server) - a test mode on production server could be used by give argument
-t
push2HAL could be installed directly from PyPI using pip install push2HAL
In addition, download this repository and run pip install . in the root folder of it.
Folder Examples contains basic example files such as:
.apihal_exampleis a credentials example file that must be edited, renamed as.apihaland located in the current working directory or in the same directory as the argument file forpdf2halorjson2hal.file.pdfthat can be used withpdf2halfor testing the behavior of the command:pdf2hal file.pdftest_comments.jsoncontains a detailed version of the JSON file that can be used withjson2hal. It contains all the possible fields of the input JSON file with basic comments. This file can not be used directly withjson2hal(usetest.jsonin place).test.jsonis a working JSON file that can be used withjson2hal:json2hal test.json.
The tools have been developed by considering documentation:
- SWORD implementation in HAL
- XSD validation format for HAL
- XML integration documentation for HAL
- common XML files for HAL
- HAL referential
- HAL API syntax for searching
- Create
xml2halcli - Add the possibility to use
pdf2halonly for finding HAL id - Return HAL document ID after creation of a new note
