Skip to main content

Httpcat Resource Storage SDK

Project description

httpcat-python-sdk

Httpcat SDK

httpcat-python-sdk GitHub配合 httpcat服务端项目使用,是httpcat服务的客户端sdk。

Httpcat SDK for Python allows you to easily upload and download your httpcat service files.

Httpcat SDK for Python 可以方便的让你上传下载你的httpcat服务文件。

安装

pip install

$ pip install httpcat-sdk

Check if the installation was successful:

(venv) [root@dev ~]# python
Python 3.8.12 (default, Aug  6 2023, 18:06:17)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import httpcat
>>> httpcat.__version__
'0.0.1'
>>>

usage:

from httpcat.services.storage.uploader import upload_file

# file_path = '/path/to/file'
file_path = '/root/aaa.txt'
upload_token = 'admin_349015:ggjTvfW266vy6KG7zOsqJZCtN3c=:eyJkZWFkbGluZSI6MH0='
upload_url = 'http://httpcat.cn/api/v1/file/upload'

response = upload_file(file_path, upload_token, upload_url)
print(response.text)

Based on your deployment of httpcat, modify the upload_token and upload_url information. The upload_token is obtained from the token management interface of the httpcat service.

根据你搭建httpcat,修改upload_token,upload_url信息 upload_token来自httpcat服务上传token管理界面。

Normal output result:

>>> print(response.text)
{"errorCode":0,"msg":"success","data":"upload successful!"}

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

httpcat-sdk-0.0.5.tar.gz (9.3 kB view details)

Uploaded Source

File details

Details for the file httpcat-sdk-0.0.5.tar.gz.

File metadata

  • Download URL: httpcat-sdk-0.0.5.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.8

File hashes

Hashes for httpcat-sdk-0.0.5.tar.gz
Algorithm Hash digest
SHA256 6a1c915344fbc026dc5ce01aa8efd6fba4183e642bdfc4fc040ea9c604ab9874
MD5 e4f9249052ca629d2c02ae9336d82808
BLAKE2b-256 8c8cf76e9cedb2d9aeef24181155be6f79efb57b6e67582cd1e7bbacbfb6980c

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