mikehibbert / arweave-python-client Goto Github PK
View Code? Open in Web Editor NEWThis client allows you to integrate your python apps with the Arweave network allowing you to perform wallet operations and transactions
License: MIT License
This client allows you to integrate your python apps with the Arweave network allowing you to perform wallet operations and transactions
License: MIT License
Running this query: https://github.com/MikeHibbert/arweave-python-client#uploading-large-files
with:
from arweave.arweave_lib import Wallet, Transaction
It throws an error in the response JSON but appears(?) to be OK and complete the transaction successfully.
The error is:
ERROR:arweave.arweave_lib:{"data": "eyduYW1lJzo....
Expected behavior
I'm not sure of "expected" behavior, or if I may just be missing because it seems(?) it more of a warning, than an error maybe?
Hello!
I use this code
`
wallet_file_path = "mywallet.json"
wallet = arweave.Wallet(wallet_file_path)
with open('myPicture.jpg', 'rb') as file:
data_file = file.read()
transaction = Transaction(wallet, data=data_file)
transaction.sign()
c = transaction.send()
print(c)
`
9/10 times I get 'Connection reset by peer'. But during this 1 normal try I see some hash info like "yAq2A-AHCmXwyFSO_jzXNct_yPBUi8P3_ZdS_Dx3GoK7c3PGtg". But I don't see image in my ARDRIVE. What is a problem? What I do wrong?
Describe the bug
On Windows 10, importing the uploader fails, due to it importing signal
Version Used
My version is 1.0.14
To Reproduce
Steps to reproduce the behavior:
from arweave.transaction_uploader import get_uploader
The issue is in transaction_uploader.py
:
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
Which causes ImportError: cannot import name 'SIGPIPE' from 'signal' (C:\Python38\lib\signal.py)
This post explains how it's not supported on Windows 10 - explanation
I'm not 100% sure what it does but I hope there's an alternative. FYI - by commenting those 2 lines out It works as expected with no errors
transaction = Transaction(wallet, id=id)
is an attribute to get the file link?
Describe the bug
The get_reward() function from arweave_lib.py fails randomly because of poor variable usage.
My guess is that the following code fails when the status.code is different than 200.
if response.status_code == 200:
reward = response.text
return reward
Here is the traceback:
File "/home/user/.local/lib/python3.8/site-packages/arweave/arweave_lib.py", line 192, in sign
data_to_sign = self.get_signature_data()
File "/home/user/.local/lib/python3.8/site-packages/arweave/arweave_lib.py", line 204, in get_signature_data
self.reward = self.get_reward(self.data_size, target_address=self.target if len(self.target) > 0 else None)
File "/home/user/.local/lib/python3.8/site-packages/arweave/arweave_lib.py", line 178, in get_reward
return reward
UnboundLocalError: local variable 'reward' referenced before assignment
I'm trying to use this lib to upload a PNG to arweave, I have something like this:
image = cv2.imread('./build/images/0.png')
transaction = arweave.Transaction(arweave_wallet, data=image)
transaction.sign()
transaction.send()
But get an error:
AppData\Local\Programs\Python\Python310\lib\site-packages\arweave\arweave_lib.py", line 118, in __init__
self.data = base64url_encode(data.encode('utf-8'))
AttributeError: 'numpy.ndarray' object has no attribute 'encode'
Any ideas how I could accomplish this?
Thanks
Describe the bug
SIGPIPE is not supported on Windows. Uploading any transactions fail on windows. I've just made the following changes locally, so it's up to you guys however you would like to fix it.
Version Used
My version is the latest version.
Proposed Solution
Put the SIGPIPE attempt in a try and ignore if it fails.
try:
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
except ImportError: # If SIGPIPE is not available (win32),
pass
When I upload successfully, I visit the link. Why should I download it instead of displaying it in the browser?
like : https://arweave.net/J71RbRXKErAaLTV_ueVPYpcGfABUm_E9teLBnp3Kziw
like : https://arweave.net/vjpC_IhtSAlmDOjZAnU3hLienLinoaY4-m_QI6HvzQI
plz help me ~
This can use the /tx_anchor instead to set the last_tx field on a transaction,
last_tx
is named like because in legacy versions it had to be the wallets last tx, but in recent versions you can use any block hash from the last 50 blocks and then submit multiple last txs
Describe the bug
ArQL is old, slow and unmaintained. You cannot just deprecate the immutable, but the endpoint is as close to this as is possible. ArQL queries are getting slower as time goes on. This is deliberate and will not be fixed. This is similar to how format 1 txs are treated compared to format 2.
Expected behavior
Use the replacement GraphQL endpoint: /graphql
Thanks a lot @MikeHibbert for your implementation of the Arweave SDK to a python library! Apart from the previous prize, you get an extra $300 paid in DAI for your great work.
I have my wallet address saved in aws secret manager. I can fetch the address at runtime but the wallet init method only allow loading the wallet from a file. Is there a way to load the Wallet with an address ?
I would like to use the Ardrive Turbo SDK to upload files using python insteam of nodejs - https://github.com/ardriveapp/turbo-sdk
Is there any api_url I can change to use their uploading service? https://upload.ardrive.io
Thanks
Describe the bug
Got an error: arweave.arweave_lib.ArweaveTransactionException: Too Many Requests
Version Used
Current
To Reproduce
Steps to reproduce the behavior:
Upload a lot of images one after the other (this time just got to 51)
Expected behavior
Upload all my images without any issues
There is a bug where data passed directly to a Transaction
object is not uploaded correctly. It computes data_root
from the Base64URL encoded data so the nodes do not recognize it and do not accept the original data.
An example. data_root
computed from the raw data is yiIbdak6AXJ17hGF5EJC_FpleCvd3pBe2c4jSZpRDVM
whereas the tx was signed with XTcZfQOhQ0byq0NjAfJbYynVMyX6fkd4IBIfRR3S0IA
- the value consistent with computing data_root
from a Base64URL encoded blob.
To fix the issue it should be sufficient to decode here and here.
Describe the bug
When using the library on Windows (because sometimes you just have to), you will encounter an error in
from signal import signal, SIGPIPE, SIG_DFL
Version Used
My version is 'latest'
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Clean import
Additional context
Add any other context about the problem here.
Hi! I followed the example in the Readme file for storing data. This seems to be unsuccessful due to an error message: tx_data_size_data_root_mismatch. What should I change?
I ran into the problem where my wallet had insufficient balance for sending a transaction. When sending the request, the server returned 200 OK but the status of the transaction was always 404 Not Found. It took me some time to figure out, that the sum of reward and quantity was higher than my actual balance. We could implement a check before sending a transaction and throw an error when the sum of quantity and reward is higher than the wallets balance. Any thoughts on this?
Kind regards,
Fabian
Hello,
I intend to retrieve link to uploaded data in this format: https://arweave.net/lOwhw7jABKgJXrtStVmU1tJaC5PR_Fk6QPekZ9ecrAk
Where lOwhw7jABKgJXrtStVmU1tJaC5PR_Fk6QPekZ9ecrAk is the ID.
However, I can't do that with get_last_transaction_id()
It seems that is not valid for what I want and I notice it changes after a short while.
So how can I retrieve uploaded data with arweave-python-client, or is this not available?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.