urlopen2


Nameurlopen2 JSON
Version 1.4.0 PyPI version JSON
download
home_page
SummaryImprovement for the `urllib.request.urlopen` function.
upload_time2023-12-15 19:20:05
maintainer
docs_urlNone
authorRomanin
requires_python>=3.7,<3.12
licenseMIT
keywords urlopen urllib.request urlfile readable seekable
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # urlopen2
## Description
Improvement for the `urllib.request.urlopen` function.

## Install
```shell
pip install urlopen2
```

## Using
### Synchronous
```python
from urlopen2 import URLFile

url = "https://example.com/file.bin"

with URLFile.open(url) as urlfile:
    urlfile.read(128)
    # In this case, 128 bytes of the file will be loaded.
    urlfile.seek(0)
    # Move the caret to the beginning of the file
    data = urlfile.read(128)
    # Since we are taking the same 128 bytes that have already been loaded, they will be received from the buffer.

print(data)
```

### Asynchronous
```python
import asyncio
import aiofiles
from urlopen2 import AsyncURLFile

url = "https://example.com/file.bin"

async def main():
    async with aiofiles.open(*AsyncURLFile.gbuf()) as abuffer:
        async with AsyncURLFile.open(url, abuffer) as aurlfile:
            await aurlfile.read(128)
            # In this case, 128 bytes of the file will be loaded.
            await aurlfile.seek(0)
            # Move the caret to the beginning of the file
            data = await aurlfile.read(128)
            # Since we are taking the same 128 bytes that have already been loaded, they will be received from the buffer.
    
    print(data)

if __name__ == "__main__":
    asyncio.run(main())
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "urlopen2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<3.12",
    "maintainer_email": "",
    "keywords": "urlopen,urllib.request,urlfile,readable,seekable",
    "author": "Romanin",
    "author_email": "semina054@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/df/38/688dd2bd952bfeabd386532268a5d5f8705bd748e77ffbf750fafbc4b6b9/urlopen2-1.4.0.tar.gz",
    "platform": null,
    "description": "# urlopen2\n## Description\nImprovement for the `urllib.request.urlopen` function.\n\n## Install\n```shell\npip install urlopen2\n```\n\n## Using\n### Synchronous\n```python\nfrom urlopen2 import URLFile\n\nurl = \"https://example.com/file.bin\"\n\nwith URLFile.open(url) as urlfile:\n    urlfile.read(128)\n    # In this case, 128 bytes of the file will be loaded.\n    urlfile.seek(0)\n    # Move the caret to the beginning of the file\n    data = urlfile.read(128)\n    # Since we are taking the same 128 bytes that have already been loaded, they will be received from the buffer.\n\nprint(data)\n```\n\n### Asynchronous\n```python\nimport asyncio\nimport aiofiles\nfrom urlopen2 import AsyncURLFile\n\nurl = \"https://example.com/file.bin\"\n\nasync def main():\n    async with aiofiles.open(*AsyncURLFile.gbuf()) as abuffer:\n        async with AsyncURLFile.open(url, abuffer) as aurlfile:\n            await aurlfile.read(128)\n            # In this case, 128 bytes of the file will be loaded.\n            await aurlfile.seek(0)\n            # Move the caret to the beginning of the file\n            data = await aurlfile.read(128)\n            # Since we are taking the same 128 bytes that have already been loaded, they will be received from the buffer.\n    \n    print(data)\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Improvement for the `urllib.request.urlopen` function.",
    "version": "1.4.0",
    "project_urls": null,
    "split_keywords": [
        "urlopen",
        "urllib.request",
        "urlfile",
        "readable",
        "seekable"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b0dbf492d7ca2cb97413b0b77037d721572e75a02b1f28f6da9586a635c9be2",
                "md5": "fdcf574051fb559ed0daedee94992159",
                "sha256": "ad46485fb4e3146db16571736b1e60ea21e6fa1ebbf98500df95621097d47cc9"
            },
            "downloads": -1,
            "filename": "urlopen2-1.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fdcf574051fb559ed0daedee94992159",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<3.12",
            "size": 6256,
            "upload_time": "2023-12-15T19:20:03",
            "upload_time_iso_8601": "2023-12-15T19:20:03.103958Z",
            "url": "https://files.pythonhosted.org/packages/5b/0d/bf492d7ca2cb97413b0b77037d721572e75a02b1f28f6da9586a635c9be2/urlopen2-1.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df38688dd2bd952bfeabd386532268a5d5f8705bd748e77ffbf750fafbc4b6b9",
                "md5": "161f90368e5347a01b6789a649ca8995",
                "sha256": "cd3caad48a2383adecfb67fd3f510f32ac48b9d9d2d4b249b6e64aa32b460d89"
            },
            "downloads": -1,
            "filename": "urlopen2-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "161f90368e5347a01b6789a649ca8995",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<3.12",
            "size": 3918,
            "upload_time": "2023-12-15T19:20:05",
            "upload_time_iso_8601": "2023-12-15T19:20:05.348850Z",
            "url": "https://files.pythonhosted.org/packages/df/38/688dd2bd952bfeabd386532268a5d5f8705bd748e77ffbf750fafbc4b6b9/urlopen2-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-15 19:20:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "urlopen2"
}
        
Elapsed time: 0.18858s