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
Release history Release notifications | RSS feed
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.2.tar.gz
(2.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file byteark_sdk-0.1.2.tar.gz.
File metadata
- Download URL: byteark_sdk-0.1.2.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.9 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8608411cb3135397aa5fff86524a2f052d9c8187d5139ce64e56b65a2f5c7565
|
|
| MD5 |
fe7af306eb67d5a636ef8f37b986cafa
|
|
| BLAKE2b-256 |
e0e4f670b87429cf7db6120bc4623a0c83a7f3a901280fe7dc80f0e90b575835
|
File details
Details for the file byteark_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: byteark_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.12.9 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7f0c32b20d2ab48d3adeba3bdf4d748478d95ba2d241b6b2483d4c893cdd80e
|
|
| MD5 |
cb99bc639b92d439e2675678c52518b6
|
|
| BLAKE2b-256 |
5a741892bc03e7e98d3983f1733387208039ee1f5df6772113233166d66a66ea
|