Git Product home page Git Product logo

pypdl's Introduction

pypdl's People

Contributors

alfish2000 avatar andrys0 avatar clinton-abraham avatar deepsource-io[bot] avatar mjishnu avatar natesawant avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

pypdl's Issues

Error when downloading from servers that doesn't support Head requests

I'm getting errors when trying to download some CSV files, even though there are no problems in the URL (tested via browser).

Is this something I'm doing wrong? Any tips on how to debug this?

Code:

from pypdl import Downloader
dl = Downloader()
dl.start('https://www.gov.br/anp/pt-br/centrais-de-conteudo/dados-abertos/arquivos/shpc/dsas/ca/ca-2004-01.csv')

Result:
ERROR:root:(ConnectionError) [Server Returned: Forbidden(403), Invalid URL]

`create_segment_table` calculation "errors"

Hi,

I was reviewing this project's code and came across what looks to be some distasteful code in create_segment_table. In

        if segment != (segments - 1):
            end -= 1  # [0-100, 100-200] -> [0-99, 100-200]
        # No segment_size+=1 for last setgment since final byte is end byte

end -= 1 should also be applied to the last segment; if the size is 200, the last byte is at index 199 (0-index, inclusive).

There is also careless use of floating points -- int(size / segments * segments) doesn't always equal size, e.g. int(109 / 11 * 11) returns 108. This problem is accidentally mitigated by the above problem. However, cases where the calculation is 2 (or greater) less can also occur, though you'll need very large files: int(9999999999999966 / 17 * 17) returns 9999999999999964.

Setting the last segment's end as size - 1 is acceptable, though the sane thing to do is to also have partition_size be an int.

Unit Tests

Are there any plans to add unit tests to this project to ensure correct functionality?

default "timeout" not working

hi, sorry for my bad English,
i have this problem : the program that i run is stuck "Speed: 0.00 MB/s, ETA: 99:59:59 " for hours,
then i tried this :
"timeout: (number or tuple, Optional) A number, or a tuple, indicating how many seconds to wait for the client to make a connection and/or send a response. Default is 20 seconds."
but somehow this do not work in python script, only work in API
i don't understand how to use this API,
can you give me tutorial how to use "timeout" feature?

ModuleNotFoundError: No module named 'utls'

I am getting a ModuleNotFoundError: No module named 'utls' while trying to from pypdl import Downloader

Looking at the source code and commit history, I think this is caused by removing the dot in main.py

from .utls import Multidown, Singledown, timestring

Can you guys help take a look? From my experience, it should work without dot, so I am not sure what the root cause is ...

Thanks,

Download stuck at 99%

I'm trying to use this package to download a files from a Gamevault server. This is the API endpoint that I am using. The auth seems to work and it will download the file segments but once it hits 99% it halts and just sits there.

from pypdl import *
from aiohttp import BasicAuth
import logging

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger()

def main():
    # Using Basic Authentication
    username = "test"
    password = "asdfghjkl"
    headers = {"User-Agent":"My cool Program/0.1"}
    auth = BasicAuth(username, password)
    print(f"Auth object: {auth}")
    dl = Pypdl(auth=auth, headers=headers)
    # Start the download
    dl.start(url='http://192.168.0.200:5006/api/games/1/download', multisegment=True, block=True)

if __name__ == '__main__':
    main()

would you happen to have any insight on how I can get this to work?

SyntaxError in Python <3.12

Steps to reproduce:

  1. Run the example usage:
from pypdl import Pypdl

dl = Pypdl()
dl.start('http://example.com/file.txt')

Expected result:

Download starts and completes.

Actual result:

SyntaxError: f-string: expecting '}'

in pypdl/factory.py", line 219,

    download_stats = f"Downloading...{" " * 95}\n"

The new f-string usage is only available in Python 3.12.

Environment:

  • Python 3.9.18
  • pypdl 1.4.0

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.