how to use nc_share.py

copy files to system

sudo cp files/{nc_share.py,nextcloud.py} /usr/local/bin/

modified nc_share.py

#from . import nextcloud
import nextcloud

add function in ~/.bashrc

ncu() {
nc_share.py "${1:--}" --user nextcloud_accoun --password nextcloud_password -v
}

install dependency

sudo apt install -y xsel xclip 
sudo pip install pyperclip keyring

apply ~/.bashrc

source ~/.bashrc

upload files to nextcloud in shell

chchang@hqdc039:~$ ncu server.cfg
OCS request: GET https://nextcloud.org/ocs/v1.php/cloud/capabilities {'headers': {'OCS-APIREQUEST': 'true'}}
DAV request: PUT /server.cfg
Headers: {'X-OC-MTIME': '1623721838'}
DAV status: 201
OCS request: POST https://nextcloud.org/ocs/v1.php/apps/files_sharing/api/v1/shares {'data': {'shareType': 3, 'path': '/server.cfg'}, 'headers': {'OCS-APIREQUEST': 'true'}}
OCS response: apps/files_sharing/api/v1
Share link URL: https://nextcloud.org/index.php/s/i83YFQgCcFjqpez
chchang@hqdc039:~$

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Recapitulation of Price Go Up AMA event held at AMA LOVERS CLUB

CS371p Fall 2021: John Mackie : Final Entry

[ENG] Dark Forest: Round 2

The DevOps tool arsenal: Results from ~100 DevOps/SRE surveys

Spiking Out a GUI Employee Time Clock

Zoom Notifications To Monitor Your Apps

The “New Scrum Master” Starter Pack

The Bootstrap Grid

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eric Chang

Eric Chang

More from Medium

How to make RSelenium work on macOS Monterey with Docker

Apple Pages app review

Storing Amazon SES Tracking Events directly in Mysql (RDS) Reduced our Load by 40%

How RChilli + Oracle HCM Cloud Help CHROs Automate Recruitment?

RChilli Resume Parser & Oracle HCM Cloud Profile Import Plugin