Skip to main content

Python wrapper to SAP HDLFS API

Project description

PyHDLFS

PythonAPI for SAP HDLFS using the RestAPI

For authentication both options are supported: key/certification and keystore/passphrase. The suffix of the certification file is used for selecting the authentication method.

  • Certification: .crt or .pem
  • Keystore: .pkcs12, .p12 or .pfx

Status: In Progress, unsupported

Generated Documentation

Table of Contents

hdlfs

get_path_content

def get_path_content(response: dict) -> list

Extracts the path items from response of LISTSTATUS API

Arguments:

  • response: Response from LISTSTATUS

Returns:

List of path items (folders and files)

get_recursive_path_content

def get_recursive_path_content(response: dict) -> list

Extracts the path items from response of LISTSTATUS_RECURSIVE API

Arguments:

  • response: Response from LISTSTATUS_RECURSIVE

Returns:

List of path items (folders and files)

hdlfs_api

def hdlfs_api(method: str, operation: str) -> dict

DECORATOR for all API-calls

Arguments:

  • method: HTTP-method [get, put, ..]
  • operation: RESTAPI name

Returns:

response of Rest API

upload

@hdlfs_api(method='put', operation='CREATE')
def upload(endpoint: str,
           certificate: str,
           password: str,
           destination='',
           data="",
           noredirect=False,
           headers={},
           verify=True) -> dict

Upload file to HDFS using CREATE-API

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • destination: destination path of file
  • data: file content
  • noredirect: API parameter
  • headers: Passing optional parameter to API
  • verify: Enables/ disables server verification

Returns:

response

rename

@hdlfs_api(method='put', operation='RENAME')
def rename(endpoint: str,
           certificate: str,
           password: str,
           path='',
           destination='',
           headers={},
           verify=True) -> dict

Rename/Move file in HDFS with RENAME-API

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • path: path to source file
  • destination: destination of file
  • headers: Passing optional parameter to API
  • verify: Enables/ disables server verification

Returns:

response

copy

@hdlfs_api(method='put', operation='COPY')
def copy(endpoint,
         certificate,
         password,
         path='',
         destination='',
         a_sync=False,
         headers={},
         verify=True)

Copy file in HDFS with Copy-API

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • path: path to source file
  • destination: destination of file
  • a_sync: API parameter
  • headers: Passing optional parameter to API
  • verify: Enables/ disables server verification

Returns:

response

delete

@hdlfs_api(method='del', operation='DELETE')
def delete(endpoint: str,
           certificate: str,
           password: str,
           path='',
           headers={},
           verify=True) -> dict

Delete file in HDFS with DELETE-API

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • path: path to source file
  • headers: Passing optional parameter to API
  • verify: Enables/ disables server verification

Returns:

response

file_status

@hdlfs_api(method='get', operation='GETFILESTATUS')
def file_status(endpoint: str,
                certificate: str,
                password: str,
                path='',
                headers={},
                verify=True)

Get file status

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • path: path to source file
  • headers: Passing optional parameter to API
  • verify: Enables/ disables server verification

Returns:

response

list_path

@hdlfs_api(method='get', operation='LISTSTATUS')
def list_path(endpoint: str,
              certificate: str,
              password: str,
              path='',
              headers={},
              verify=True)

Get all items of folder by using LISTSTATUS-API

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • path: path to source file
  • headers: Passing optional parameter to API
  • verify: Enables/ disables server verification

Returns:

response

list_path_recursive

@hdlfs_api(method='get', operation='LISTSTATUS_RECURSIVE')
def list_path_recursive(endpoint: str,
                        certificate: str,
                        password: str,
                        path='',
                        start_after=None,
                        headers={},
                        verify=True) -> dict

Get all items of folder and sub-folders by using LISTSTATUS_RECURSIVE-API

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • path: path to source file
  • start_after: API parameter for paging result
  • headers: Passing optional parameter to API
  • verify: Enables/ disables server verification

Returns:

response

whoami

@hdlfs_api(method='get', operation='WHOAMI')
def whoami(endpoint: str, certificate: str, password: str, verify=True)

Get user information by WHOAMI-API

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • verify: Enables/ disables server verification

Returns:

response

get_operations_status

@hdlfs_api(method='get', operation='GETOPERATIONSTATUS')
def get_operations_status(endpoint: str,
                          certificate: str,
                          password: str,
                          token='',
                          verify=True) -> dict

Get operation status by GETOPERATIONSTATUS-API

Arguments:

  • endpoint: endpoint url
  • certificate: filename with path to certificate or pkcs12-keystore
  • password: filename with path to key or passphrase for keystore
  • verify: Enables/ disables server verification

Returns:

response

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

pyhdlfs-0.0.17.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

pyhdlfs-0.0.17-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file pyhdlfs-0.0.17.tar.gz.

File metadata

  • Download URL: pyhdlfs-0.0.17.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for pyhdlfs-0.0.17.tar.gz
Algorithm Hash digest
SHA256 409c3aa40bae25285ff0f0e2c96c375a4310d8b052bdd13dce70c68a23e5ec0f
MD5 63858f14bfe3f0fb726e551c6f4a59ea
BLAKE2b-256 84be9193892907180c61b17d7fd212f554b5f1b238bd6636534e5c800a8481ab

See more details on using hashes here.

File details

Details for the file pyhdlfs-0.0.17-py3-none-any.whl.

File metadata

  • Download URL: pyhdlfs-0.0.17-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for pyhdlfs-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 f4ea2395759b4661bcf0ca0ab933d0fe4f6772185b33046f24b1636c12861ba2
MD5 d876ab29b8cd7e572031ab55e04ac643
BLAKE2b-256 d181383c1bb99d36c93d12218052c3efc23284d1a1f79b96fe6681c861984526

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