Code Monkey home page Code Monkey logo

sxcu's Issues

Handling Server Errors

Currently, the error response leads to JSON decode error. It should not happen and it must be handled by reading status code and custom errors must be raised.

Check whether image is valid

Currently, the image file specified is just uploaded no matter what is it. Add a check for it and raise a Value error when it is invalid.

Implement Logging

Logging is necessary and can be done easily using the default logging module. This would help to debug errors. A new class for logging would do.

Some More examples

Hey bro Can you pls share some more examples like this (I Don't know much about python😅(
import sxcu
connector = sxcu.SXCU()
result = connector.upload_image("foo.png")
print(result["url"])

For subdomain
And If you are on Telegram can you pls share you id

Passing image content as parameter rather then image file path

Location

as can be seen here (and some other places)

with open(file, "rb") as img_file:
    files = {"file": img_file}
    res = request_handler.post(url, files=files, data=data)

The Problem

The wrapper accepts file paths over the file's content itself and then handles reading from that path. This is a problem when a user gets an image dynamically from some algorithm because then they have to write to the disk and supply that file path (not only slow but can cause errors based on permissions and os differences).

The Solution

possible solutions include:

  • Make the user handle reading from files.
  • having two separate parameters, one being path another being file content and expecting exactly one.
  • have one parameter, file_or_path which is handled differently based on its data type (bytes == file content, string == file path)

I'd be willing to make a PR if you know which solution you'd like to choose. In my opinion, now is a good time to change something like this because the API is already changing a lot due to v1 being deprecated. Let me know what you think :)

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.