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.8.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.8-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

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

Hashes for ward-labels-upload-0.0.8.tar.gz
Algorithm Hash digest
SHA256 7ba5b5718ba2feb9cae5c61d76eef3c458b580b3d0479953117bf01e23fe1ea0
MD5 5846870d0629ac9ca78e5f13da606bcb
BLAKE2b-256 0ded8def517c2386de499d6c2ab979d20d275d58f235773bb73bcc08ad30daba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ward_labels_upload-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 8ff5d7928c13be40175f8a35eddb3ea154c42a515e37e86282b0fe4ea387f86f
MD5 b8dd9c7cd498c530dc2f1979b6e42860
BLAKE2b-256 c54398619d53d54a6b565695d5c6ccc6999a99f97f631aec0bbe9dd228f2897f

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