Skip to main content

Tools to push content to HAL repo

Project description

Firefly push2HAL-ordinateur 55689

GitHub License PyPI - Version GitHub Actions Workflow Status

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):

  • pdf2hal is able to upload a PDF file to an existing notice on HAL (only with valid permission to modify it).
  • json2hal is 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 - Upload PDF file to an existing notice in HAL

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:

usage: pdf2hal [-h] [-a HALID] [-c CREDENTIALS] [-v] [-e] [-l LOGIN] [-p PASSWD] [-f] pdf_path

Arguments

  • positional argument: pdf_path Path 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 - Create a new note on HAL w/- or w/o additional file

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:

usage: json2hal [-h] [-c CREDENTIALS] [-v] [-e] [-t] [-l LOGIN] [-p PASSWD] [-cc COMPLETE] [-id IDHAL] json_path

Arguments

  • positional argument: json_path Path 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

Note that:

  • HAL credentials (for production or pre-production server) could be provided using .apihal based on JSON syntax (see .apihal_example)
  • by default, the preprod server is used (argument -e use the production server)
  • a test mode on production server could be used by give argument -t

Installation

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.

Examples

Folder Examples contains basic example files such as:

  • .apihal_example is a credentials example file that must be edited, renamed as .apihal and located in the current working directory or in the same directory as the argument file for pdf2hal or json2hal.
  • file.pdf that can be used with pdf2hal for testing the behavior of the command: pdf2hal file.pdf
  • test_comments.json contains a detailed version of the JSON file that can be used with json2hal. It contains all the possible fields of the input JSON file with basic comments. This file can not be used directly with json2hal (use test.json in place).
  • test.json is a working JSON file that can be used with json2hal: json2hal test.json.

References

The tools have been developed by considering documentation:

Todo

  • Create xml2hal cli
  • Add the possibility to use pdf2hal only for finding HAL id
  • Return HAL document ID after creation of a new note

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

push2hal-0.3.9.tar.gz (56.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

push2hal-0.3.9-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

Details for the file push2hal-0.3.9.tar.gz.

File metadata

  • Download URL: push2hal-0.3.9.tar.gz
  • Upload date:
  • Size: 56.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for push2hal-0.3.9.tar.gz
Algorithm Hash digest
SHA256 6347ab57b657fcb5dcce3d49db3a8c7caa784edda0dc705fc80ea970732e846a
MD5 24bcb28931f1b741e7cd5f7ea32cb8e3
BLAKE2b-256 909fc21b683baf1bff6bed4aa0ee51ea1c932c85b66f0bc53f5b289aecb914e4

See more details on using hashes here.

File details

Details for the file push2hal-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: push2hal-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 52.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.3

File hashes

Hashes for push2hal-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 f0feb411da0f0c8568d3c0e4d144c2f57c1a7c4aa00e9c2e74b001ca20332b7c
MD5 658de4d29fafa2c56dd4dd4f4f2500e1
BLAKE2b-256 bda1cbaa5967ac122aad95362becd8c3c0e0e2e257219eb4641a83713afbd46f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page