Git Product home page Git Product logo

python-skynet's People

Contributors

dawe35 avatar kcchouette avatar latenthero avatar mrcnski avatar msevey avatar pdxwebdev avatar peterjan avatar xloem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-skynet's Issues

Feature Request: Python CLI Tool

This would ease testing the library and provide multiple options in addition to the nodejs tool, for users of edge-case systems.

Assertion Error: in _upload.py

i think there is some problem in the upload_directory function.

i tried to run a simple example
pic1

it gives me an AssertionError (pic2)
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.

how to use Skynet.upload_file using flask

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")

Feature Request: onUploadProgress

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.

Tests pretend to verify content access

The upload tests take the energy to verify the returned skylink (

if SIALINK != sialink2:
) but they themselves provide this skylink (
json={'skylink': SKYLINK},
). They seem to be simply testing the mocking responses 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.

siasky.net compatibility

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)

Ability to set request timeout

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

Unexport helper methods

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.