kopia lustrzana https://github.com/bugout-dev/moonstream
Handled unicode code points that can't be stored in Postgres
Also applied MOONSTREAM_SPIRE_API_URL configuration to mooncrawl reporter so that we can report to non-production Spire APIs.pull/283/head
rodzic
4bf2b5311d
commit
126090ab54
|
@ -302,13 +302,24 @@ def label_erc721_addresses(
|
||||||
for address, id in address_ids:
|
for address, id in address_ids:
|
||||||
try:
|
try:
|
||||||
contract_info = get_erc721_contract_info(w3, address)
|
contract_info = get_erc721_contract_info(w3, address)
|
||||||
|
|
||||||
|
# Postgres cannot store the following unicode code point in a string: \u0000
|
||||||
|
# Therefore, we replace that code point with the empty string to avoid errors:
|
||||||
|
# https://stackoverflow.com/a/31672314
|
||||||
|
contract_name = contract_info.name.replace("\\u0000", "").replace(
|
||||||
|
"\x00", ""
|
||||||
|
)
|
||||||
|
contract_symbol = contract_info.symbol.replace("\\u0000", "").replace(
|
||||||
|
"\x00", ""
|
||||||
|
)
|
||||||
|
|
||||||
labels.append(
|
labels.append(
|
||||||
EthereumLabel(
|
EthereumLabel(
|
||||||
address_id=id,
|
address_id=id,
|
||||||
label=NFT_LABEL,
|
label=NFT_LABEL,
|
||||||
label_data={
|
label_data={
|
||||||
"name": contract_info.name,
|
"name": contract_name,
|
||||||
"symbol": contract_info.symbol,
|
"symbol": contract_symbol,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from humbug.consent import HumbugConsent
|
from humbug.consent import HumbugConsent
|
||||||
|
@ -8,6 +9,8 @@ from .settings import HUMBUG_REPORTER_CRAWLERS_TOKEN
|
||||||
session_id = str(uuid.uuid4())
|
session_id = str(uuid.uuid4())
|
||||||
client_id = "moonstream-crawlers"
|
client_id = "moonstream-crawlers"
|
||||||
|
|
||||||
|
spire_url = os.environ.get("MOONSTREAM_SPIRE_API_URL")
|
||||||
|
|
||||||
reporter = HumbugReporter(
|
reporter = HumbugReporter(
|
||||||
name="moonstream-crawlers",
|
name="moonstream-crawlers",
|
||||||
consent=HumbugConsent(True),
|
consent=HumbugConsent(True),
|
||||||
|
@ -15,4 +18,5 @@ reporter = HumbugReporter(
|
||||||
session_id=session_id,
|
session_id=session_id,
|
||||||
bugout_token=HUMBUG_REPORTER_CRAWLERS_TOKEN,
|
bugout_token=HUMBUG_REPORTER_CRAWLERS_TOKEN,
|
||||||
tags=[],
|
tags=[],
|
||||||
|
url=spire_url,
|
||||||
)
|
)
|
||||||
|
|
Ładowanie…
Reference in New Issue