Skip to main content

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

ward-labels-upload-0.0.10.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

ward_labels_upload-0.0.10-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file ward-labels-upload-0.0.10.tar.gz.

File metadata

  • Download URL: ward-labels-upload-0.0.10.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for ward-labels-upload-0.0.10.tar.gz
Algorithm Hash digest
SHA256 15ede5d4f9be76d2eee8c12e45f05b5efeb85a5014e19e68b8f694ab803eacf3
MD5 13209803c1c231141a1f02380c5d4934
BLAKE2b-256 c89c57f71f995b1bd0289c25813d27e62c1688856482f14dcff0cc7b5ececeff

See more details on using hashes here.

File details

Details for the file ward_labels_upload-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for ward_labels_upload-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 559f2e3aaf3a9a4220c655459d65bea7a7c3ea8867e0904cb443fbd6eed57ab1
MD5 d2db95ddc1a10dc37a37a0f8e38fb65d
BLAKE2b-256 e010e9edeb62b673a9250a5956f5c9ed133f6c2d72aa2e82b57a8c52111be717

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