Skip to main content

No project description provided

Project description

ByteArk SDK for Python

Intallation

pip install byteark-sdk

Usage

from byteark_sdk import ByteArkSigner

signer = ByteArkSigner(
    access_key="2Aj6Wkge4hi1ZYLp0DBG",
    access_secret="31sX5C0lcBiWuGPTzRszYvjxzzI3aCZjJi85ZyB7"
)
signed_url = signer.sign(
    'https://example.cdn.byteark.com/path/to/file.png',
    1514764800
)
print(signed_url)

# Output:
#    https://example.cdn.byteark.com/path/to/file.png
#       ?x_ark_access_id=2Aj6Wkge4hi1ZYLp0DBG
#       &x_ark_auth_type=ark-v2
#       &x_ark_expires=1514764800
#       &x_ark_signature=OsBgZpn9LTAJowa0UUhlYQ

Sign URL with options

Option Required Default Description
method - GET HTTP Method that allowed to use with the signed URL
path_prefix - - Path prefix that allowed to use with the signed URL
client_ip - - Legacy signing conditions
user_agent - - Legacy signing conditions
# Sign with HTTP HEAD method
signed_url = signer.sign(
    "https://example.cdn.byteark.com/path/to/file.png",
    expires=1514764800,
    options={"method": "HEAD"},
)

# Sign with path_prefix
signed_url = signer.sign(
    "https://example.cdn.byteark.com/path/to/file.png",
    expires=1514764800,
    options={"path_prefix": "/path/to/"},
)

# Sign with client IP
signed_url = signer.sign(
    "https://example.cdn.byteark.com/path/to/file.png",
    expires=1514764800,
    options={"client_ip": "123.123.123.123"},
)

# Sign with clinet IP and User-Agent
user_agent = (
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) "
    "AppleWebKit/537.36 (KHTML, like Gecko) "
    "Chrome/58.0.3029.68 Safari/537.36"
)
signed_url = signer.sign(
    "https://example.cdn.byteark.com/path/to/file.png",
    expires=1514764800,
    options={"client_ip": "123.123.123.123", "user_agent": user_agent},
)

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

byteark_sdk-0.1.1a1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

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

byteark_sdk-0.1.1a1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file byteark_sdk-0.1.1a1.tar.gz.

File metadata

  • Download URL: byteark_sdk-0.1.1a1.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.8 Darwin/24.2.0

File hashes

Hashes for byteark_sdk-0.1.1a1.tar.gz
Algorithm Hash digest
SHA256 65101e4cb8ed4ca38b1a8dfe95a2a74eb1ec07040067f5d5b3e8c0991ae34e3a
MD5 cdf8c83c4089ef580945b6a6ee5f9311
BLAKE2b-256 d13c0f3a8633c5055f0fcf0b0634bdde77ef469f723e4111fa886e1dfbf17a09

See more details on using hashes here.

File details

Details for the file byteark_sdk-0.1.1a1-py3-none-any.whl.

File metadata

  • Download URL: byteark_sdk-0.1.1a1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.8 Darwin/24.2.0

File hashes

Hashes for byteark_sdk-0.1.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1b3b5fc681c59204a3c4a90e671a6498fa1a7db0a0a83fd88d4e7eac49e7c13
MD5 cc198bd87cb1a0f3eec503a64ef0952f
BLAKE2b-256 f1d8057861edff07009016d553c6246d06b0ee4572c74680a480a69a570908b8

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