nebulouslabs / python-skynet Goto Github PK
View Code? Open in Web Editor NEWLibrary for integrating Skynet with Python applications
License: MIT License
Library for integrating Skynet with Python applications
License: MIT License
Current value:
'https://siasky.net/',
'portalUploadPath' : '/api/skyfile',
'portalFileFieldname' : 'file',
'customFilename':
Expected value:
'https://siasky.net/',
'portalUploadPath' : '/skynet/skyfile/',
'portalFileFieldname' : 'file',
'customFilename':
This would ease testing the library and provide multiple options in addition to the nodejs tool, for users of edge-case systems.
This test where the data is stripped doesn't look correct to me: https://github.com/NebulousLabs/python-skynet/blob/master/tests/test_integration_upload.py#L47
I'm working on some changes that remove the call to strip
, so I'm opening this issue to reference the situation. I don't understand why it is there.
It will be helpful if app developer gets an option to overwrite "default portal endpoint" in sdk
'': 'https://siasky.net',
'portalUploadPath' : '/api/skyfile',
'portalFileFieldname' : 'file',
'customFilename':''
It would be nice if a set of webportals could be provided, and they might be used round-robin or as backup mirrors if a primary one goes down.
i think there is some problem in the upload_directory function.
i tried to run a simple example
it gives me an AssertionError (pic2)
if i comment out line 195 in the _upload.py the upload works without any errors.
but still something is wrong with the folder and file structure. for example a index.html cannot
correctly load a file in css/style.css
If i upload the same folder with the siasky.net webportal the files are linked correctly.
Hi,
this is not an issue,I just need help :)
i want to use skylink = Skynet.upload_file("./src.jpg") to build a website using flask. the problem is the return of the selected file by users not a path of this file. I am asking if there is a way to upload the file without knowing the path. like skylink = Skynet.upload_file("filename.jpg")
please make the onUploadProgess callback available in the skynet python api.
would be really beneficial to show the progress of uploads in python applications.
thank you.
We should support uploading generic data using streams.
We will need to use the https://toolbelt.readthedocs.io/ library for this as requests
does not support this.
The upload tests take the energy to verify the returned skylink (
) but they themselves provide this skylink ( ). They seem to be simply testing the mockingresponses
library at this point. It seems a little dangerous as it could seem like it is testing more than it really is, to casual review.The SDK works with the most of portals, except siasky.net:
opts = type('obj', (object,), {
'portal_url': 'https://siasky.net',
'portal_upload_path': 'skynet/skyfile',
'portal_file_fieldname': 'file',
'portal_directory_file_fieldname': 'files[]',
'custom_filename': ''
})
skylink = Skynet.upload_file(saveTo, opts)
Traceback (most recent call last):
File "C:\Users\Hp\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 917, in _bootstrap_inner
self.run()
File "C:\Users\Hp\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "C:\Wamp.NET\sites\archive\Skylive\uploader.py", line 46, in share
skylink = Skynet.upload_file(saveTo, opts)
File "C:\Users\Hp\AppData\Local\Programs\Python\Python37-32\lib\site-packages\siaskynet\skynet.py", line 37, in upload_file
return Skynet.uri_skynet_prefix() + Skynet.upload_file_request(path, opts).json()["skylink"]
File "C:\Users\Hp\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\Hp\AppData\Local\Programs\Python\Python37-32\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Users\Hp\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Hp\AppData\Local\Programs\Python\Python37-32\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
It would be nice, for large files, to simple verify that the skylink to them is correct, and discern what their size is.
For SkyLive it would be very useful. Sometimes a portal does not answer and I need to switch to another before it's too late.
Example code:
try:
url = "http://google.com"
r = requests.get(url, timeout=10)
except requests.exceptions.Timeout as e:
print e
Helper methods should be private (starting with two underscores) so as not to clutter up the public interface. For example, upload_file
should be part of the public API but not upload_file_request
.
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.