Skip to main content

ebcloudstore is a sdk for 53iq cloud

hello,world

from ebcloudstore.client import EbStore
store = EbStore("your token")
r = store.upload("/your/file/path/hello.jpg")
print(r)

use in tornado

def post(self):
    if len(self.request.files) > 0:
        file_metas = self.request.files["myfile"]
        for meta in file_metas:
            from ebcloudstore.client import EbStore
            store = EbStore("your token")
            r = store.upload(meta['body'], meta['filename'], meta["content_type"])
            self.write(r)

use in django

def test(request):
    if request.method == "POST":
        if len(request.FILES.dict()) >= 1:
            f = request.FILES["myfile"]
            from ebcloudstore.client import EbStore
            store = EbStore("your token")
            r = store.upload(f.read(), f.name, f.content_type)
            return HttpResponse(r)

callback after finished

from ebcloudstore.client import EbStore
# will post the body data result to callback_url when upload finished (5 seconds timeout)
store = EbStore("your token",action="callback",callback_url="http://your.domain.receive")
r = store.upload("/your/file/path/hello.jpg")

set upload timeout

from ebcloudstore.client import EbStore, EbStoreUploadTimeoutException
store = EbStore("your token")
try:
    # 20 seconds timeout
    r = store.upload("/your/file/path/hello.jpg", timeout=20)
    print(r)
except EbStoreUploadTimeoutException:
    print("timeout!please retry")

redirect after finished

from ebcloudstore.client import EbStore
# will redirect the referer url when upload finished
store = EbStore("your token",action="redirect",referer="http://your.domain.receive")
r = store.upload("/your/file/path/hello.jpg")
  • tips: also can use javascript in web browser direct upload file to cloud server

Installation

Automatic installation:

pip install ebcloudstore
  • once you want to use this sdk,first of all you need a token, apply for by email to tsengdavid@126.com

  • only python3.x supported

Download files

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

Source Distribution

ebcloudstore-1.3.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file ebcloudstore-1.3.tar.gz.

File metadata

  • Download URL: ebcloudstore-1.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ebcloudstore-1.3.tar.gz
Algorithm Hash digest
SHA256 d9f7697748527c6a384dada5b6d4cccc2de97445934184fe1db278b7d5f0bdba
MD5 88afba9b68336a860cdc21e613463e0b
BLAKE2b-256 0780f060fdd5a0f11bdf8112c2b6171ceb1dccd92bfa08b9c402f541e33cf1cd

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.3 This release

1 file

1.2

1 file

1.1

2 files

1.0

2 files

Supported by

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