Giter Site home page Giter Site logo

python-sdk's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-sdk's Issues

Loosen requests version requirement

Hello,

In the current setup.py the version for requests is locked to 2.11.1, is it possible to make the requirement as < 3 and > 2.11 ?

Using pipenv it is not possible to install this package if a higher version of requests is already present.

Thanks!

Loosen dependency requirements

Hello,

I tracked down an issue with installing this package using pipenv.

To make the story short could you remove of at least loosen the dependency on tuspy? Tuspy v0.2.3 got rid of requirements.txt and this sdk should probably do the same.

tuspy 0.2.2 used to have specific version of certifi which makes pipenv refusing to install any newer version.

 - tuspy [required: ==0.2.2, installed: 0.2.2]
    - certifi [required: ==2017.7.27.1, installed: 2018.8.24]
    - future [required: ==0.16.0, installed: 0.16.0]

I see there already is install_requires in setup.py so I'm not sure what is best.

Thanks!

The latest release requires pypandoc, which requires pandoc to be installed

This is caused by import pypandoc, and the use of pypandoc in setup.py.

This is a huge issue with server installs since it requires pandoc to be available on the server. It is also very much a strange thing to require developers to have available on their development machines just to use the library (since long_description is only used to generate the pypi pages).

If you really need to use pypandoc in setup.py, could you at least use something like this?:

try:
    import pypandoc
except ImportError:
    pypandoc_available = False
else:
    pypandoc_available = True

# ...

if pypandoc_available:
     long_description = pypandoc.convert('README.md', 'rst')
     long_description = long_description.replace("\r","")
else:
     try:
          long_description = open('README.md', 'r).read()
     except IOError:
          long_description = ''

Simpler and less error prone alternatives:

  • use a README.rst instead of a README.md, and not require pypandoc at all.
  • use a long_description that just say that the docs are available at https://transloadit.readthedocs.io/.

Assembly Create retries do not return the results of the retry

The automatic retries when creating a new assembly seem to have a logic bug.

Looking at this chunk of code

    def create(self, wait=False, resumable=True, retries=3):
        """
        Save/Submit the assembly for processing.

        :Args:
            - wait (Optional[bool]): If set to True, the method will wait till the assembly
                processing is complete before returning a response.
            - resumable (Optional[bool]): A flag indicating if the upload should be resumable.
                This is good for cases of network failures. Defaults to True if not specified.
            - retries (Optional[int]): In the event of an upload failure, this specifies how many
                more times the upload should be retried before crying for help. This option is only
                available if 'resumable' is set to 'True'. Defaults to 3 if not specified.
        """
        data = self.get_options()
        if resumable:
            extra_data = {"tus_num_expected_upload_files": len(self.files)}
            response = self.transloadit.request.post(
                "/assemblies", extra_data=extra_data, data=data
            )
            self._do_tus_upload(
                response.data.get("assembly_ssl_url"),
                response.data.get("tus_url"),
                retries,
            )
        else:
            response = self.transloadit.request.post(
                "/assemblies", data=data, files=self.files
            )

        if wait:
            while not self._assembly_finished(response):
                sleep(1)  # avoid hitting a rate limit
                response = self.transloadit.get_assembly(
                    assembly_url=response.data.get("assembly_ssl_url")
                )

        if self._rate_limit_reached(response) and retries:
            # wait till rate limit is expired
            sleep(response.data.get("info", {}).get("retryIn", 1))
            self.create(wait, resumable, retries - 1)

        return response

everything seems fine except this line here

            self.create(wait, resumable, retries - 1)

I believe that should be

            return self.create(wait, resumable, retries - 1)

ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)

Hi, we are using trying to run the tutorial https://transloadit.com/demos/file-importing/import-a-file-over-http/.
When we start the server, an error occurs. Do you know what is causing it?

This is our setup:

  • Python 3.6
  • Tranloadit 0.1.7
  • Django 1.11.7

Error:
ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x1031b1378>
Traceback (most recent call last):
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/sslserver/management/commands/runsslserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/mac/PycharmProjects/clickandrap/django_settings/urls.py", line 26, in <module>
    url(r'^transloadit/', include('transloadit_module.urls')),
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/django/conf/urls/__init__.py", line50, in include
    urlconf_module = import_module(urlconf_module)
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/mac/PycharmProjects/clickandrap/transloadit_module/urls.py", line 3, in <module>
    from transloadit_module.views import *
  File "/Users/mac/PycharmProjects/clickandrap/transloadit_module/views.py", line 3, in <module>
    from transloadit import client
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/transloadit/client.py", line 2, in <module>
    from . import assembly
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/transloadit/assembly.py", line 4, in <module>
    from tusclient import client as tus
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/tusclient/client.py", line 1, in <module>
    from tusclient.uploader import Uploader
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/tusclient/uploader.py", line 11, in<module>
    from tusclient.request import TusRequest
  File "/Users/mac/.local/share/virtualenvs/clickandrap-0ABdElTc/lib/python3.6/site-packages/tusclient/request.py", line 1, in <module>
    import pycurl
ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)

Add python 3.12 support

Hello,

I was looking to update my project that uses this library to Python 3.12, but this version is blocked in the pyproject.toml:

[tool.poetry.dependencies]
python = ">=3.7,<3.12"

If it's possible, can the version be bumped to <3.13?

Thanks!

Looking for a maintainer

๐Ÿ‘‹ Hi there, Ife left Transloadit and we're looking for someone to maintain this Python SDK. One often heard feature request is:

  • Adding Asyncio support #9

So before deciding, you could already ponder about if this is to your liking.

Shoot me an email or tweet if you are interested, it would be a paid thing and only require a few hours here and there.

/cc @arnaudlimbourg something for you maybe?

Issue installing pytransloadit

Hello, I'm having issues install pytransloadit with pip.
It's giving me this

Collecting pytransloadit
  Using cached pytransloadit-0.1.4.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/l8/3l7c5px141140t1lc2_qcv040000gn/T/pip-build-ud0eqbr1/pytransloadit/setup.py", line 12, in <module>
        long_description = pypandoc.convert('README.md', 'rst').replace("\r", "")
      File "/Users/madreal/Sites/clickandrap_django/venv/lib/python3.6/site-packages/pypandoc/__init__.py", line 66, in convert
        raise RuntimeError("Format missing, but need one (identified source as text as no "
    RuntimeError: Format missing, but need one (identified source as text as no file with that name was found).
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/l8/3l7c5px141140t1lc2_qcv040000gn/T/pip-build-ud0eqbr1/pytransloadit/

I tried also installing pypandoc first but no difference

Requests time out when sent from the Python SDK

It's only an issue when creating assemblies with the Python SDK, even if they're the first assemblies I've made that day.

Error message that gets displayed:

{'error': 'RATE_LIMIT_REACHED', 'message': 'Request limit reached', 'http_code': 429, 'info': {'retryIn': 0}}

Video showcasing the issue:
https://user-images.githubusercontent.com/36996165/171034785-903f6308-b320-4fbd-bd36-3ee1d231e2e6.mp4

Python Code to replicate:

# pip install pytransloadit
from transloadit import client

tl = client.Transloadit('AUTH_KEY', 'AUTH_SECRET')
assembly = tl.new_assembly()

# Set Encoding Instructions
assembly.add_step(':original', '/upload/handle', {})
assembly.add_step('resized', '/image/resize', {
  'use': ':original',
  'result': True,
  'height': 500,
  'imagemagick_stack': 'v2.0.7',
  'resize_strategy': 'fit',
  'width': 500,
  'zoom': False
})

# Add files to upload
assembly.add_file(open('demo.jpg', 'rb'))

# Start the Assembly
assembly_response = assembly.create(retries=0, wait=True)

print(assembly_response.data)

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.