An internal package to allow for easy uploading of labels to the Ward Analytics API.
Project description
Ward Analytics Labels Upload Utility
This utility is used to upload labels to the Ward Analytics Database.
It is for internal use only.
Installation
pip install ward-labels-upload
Usage
The Label Object
The Label object is used to represent a label. It has three fields:
address: The address of the label.label: The label itself.description: A description of the label.
It also has a is_address_case_sensitive field, which defaults to False. This field is used to determine whether the address field should be treated as case sensitive or not. In most cases, this field should be left as False (For blockchains such as Ethereum, addresses are not case sensitive).
from ward_labels_upload import Label
label = Label(address="0x12eF3", label="label1", description="description1")
print(label)
>>> Label(address="0x12ef3", label="label1", description="description1", is_address_case_sensitive=False)
from ward_labels_upload import Label
label = Label(address="0x12eF3", label="label1", description="description1", is_address_case_sensitive=True)
print(label)
>>> Label(address="0x12eF3", label="label1", description="description1", is_address_case_sensitive=True)
Label Upload
from ward_labels_upload import Label, LabelUploader
uploader = LabelUploader(api_key="your_api_key")
labels = [
Label(address="0x12ef3", label="label1", description="description1"),
Label(address="0x45af6", label="label2", description="description2"),
Label(address="0x78cs9", label="label3", description="description3"),
]
uploader.upload_labels(labels=labels)
The LabelUploader class also takes an optional base_url parameter. This is the base URL of the Ward Analytics API. It defaults to https://api.wardanalytics.net, which is the production API.
Label Deletion
from ward_labels_upload import Label, LabelUploader
uploader = LabelUploader(api_key="your_api_key")
labels = [
Label(address="0x12ef3", label="label1"),
Label(address="0x45af6", label="label2"),
Label(address="0x78cs9", label="label3"),
]
uploader.delete_labels(labels=labels)
In the case of deletion, the description field is unnecessary. This happens because a label is uniquely identified by the combination of its address and label.
Label Retrieval
from ward_labels_upload import Label, LabelUploader
uploader = LabelUploader(api_key="your_api_key")
addresses = [
"0x12ef3",
"0x45af6",
"0x78cs9",
]
labels = uploader.get_labels(addresses=addresses)
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
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 ward-labels-upload-0.0.8.tar.gz.
File metadata
- Download URL: ward-labels-upload-0.0.8.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ba5b5718ba2feb9cae5c61d76eef3c458b580b3d0479953117bf01e23fe1ea0
|
|
| MD5 |
5846870d0629ac9ca78e5f13da606bcb
|
|
| BLAKE2b-256 |
0ded8def517c2386de499d6c2ab979d20d275d58f235773bb73bcc08ad30daba
|
File details
Details for the file ward_labels_upload-0.0.8-py3-none-any.whl.
File metadata
- Download URL: ward_labels_upload-0.0.8-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ff5d7928c13be40175f8a35eddb3ea154c42a515e37e86282b0fe4ea387f86f
|
|
| MD5 |
b8dd9c7cd498c530dc2f1979b6e42860
|
|
| BLAKE2b-256 |
c54398619d53d54a6b565695d5c6ccc6999a99f97f631aec0bbe9dd228f2897f
|