Skip to content

Commit ac14614

Browse files
committed
remove external file and generate local pdf
1 parent cbaf5db commit ac14614

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

examples/more_examples/09_sign_document_data.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
from hashlib import sha256
99
import urllib.request
1010
import json
11+
from reportlab.pdfgen import canvas
12+
13+
1114

1215
def split_into_64chars(string):
1316
return [string[i:i+64] for i in range(0, len(string), 64)]
@@ -17,10 +20,15 @@ def split_into_64chars(string):
1720
wallet_mnemonic = os.getenv('wallet_mnemonic')
1821
blockfrost_api_key = os.getenv('blockfrost_api_key')
1922

20-
file_url = "https://archive.podaac.earthdata.nasa.gov/podaac-ops-cumulus-docs/web-misc/opera/atbd/D-108763_Rev_A_OPERA_DSWx_S1_NI_ATBD_20240530_SIGNED.pdf"
23+
2124
filename = "tempfile.pdf"
25+
pdf = canvas.Canvas(filename)
26+
pdf.drawString(100, 750, "Hello, this is an example PDF!")
27+
28+
pdf.save()
29+
30+
2231

23-
urllib.request.urlretrieve(file_url, filename)
2432

2533

2634
h256 = sha256()

examples/more_examples/11_verify_fake_document.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from hashlib import sha256
99
import urllib.request
1010
import json
11+
from reportlab.pdfgen import canvas
12+
1113

1214
def split_into_64chars(string):
1315
return [string[i:i+64] for i in range(0, len(string), 64)]
@@ -26,7 +28,13 @@ def split_into_64chars(string):
2628
base_url = ApiUrls.mainnet.value
2729
cardano_network = Network.MAINNET
2830

31+
2932
filename = "tempfile_copy.pdf"
33+
pdf = canvas.Canvas(filename)
34+
pdf.drawString(100, 750, "Hello, this is a copy of the example PDF!")
35+
36+
pdf.save()
37+
3038
h256 = sha256()
3139
h256.update(open(filename,'rb').read())
3240
document_hash = h256.hexdigest()

0 commit comments

Comments
 (0)