Skip to main content

Httpcat Resource Storage SDK

Project description

myhttpcatlab-python-sdk

myhttpcatlab

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

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

安装

通过pip安装

$ pip install myhttpcatlab

检查是否安装成功

(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 myhttpcatlab
>>> httpcat.__version__
'0.0.1'
>>>

使用:

from myhttpcatlab.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)

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

正常输出结果:

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

myhttpcatlab-0.0.3.tar.gz (8.1 kB view details)

Uploaded Source

File details

Details for the file myhttpcatlab-0.0.3.tar.gz.

File metadata

  • Download URL: myhttpcatlab-0.0.3.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.1

File hashes

Hashes for myhttpcatlab-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f9707448ced1e2fe748adf113d6f576c904c577a10d796b73e7e1d52c56aeec0
MD5 e6abc292fa3861be1ce6a67e3597d9da
BLAKE2b-256 bfdd6101c1b60574b7d9236b978c0d97d3754db715f8d0439e43df73198721f4

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