Project description
This is a utility project that helps you download files attached to an api response and save them locally. It also includes method for downloading network images to your local storage.
The api_server.api_downloader manages all downloads for images linked with any json response.
Supported Input Types
The api-clone supports both json and normal python dictionaries for scraping api response. For downloading urls from url, a string would be required
Installation
The installation is simple:
pip install api-clone
Usage
- To download a single image from a url
from api_clone.api_downloader import saveImage
saveImage(image_url='url_of_image', folder_name='name of folder to save the image')
- To save all images from a json response locally on your device
from api_clone.api_downloader import ApiDownloader
downloader = ApiDownloader(your_json_response_here)
downloader.downloadAllImages(folder_name='name of folder for saving images')
- Save all images under a specific
keyin the json file. This method saves images with values having the same key as you specified.
from api_clone.api_downloader import ApiDownloader
downloader = ApiDownloader('json_response')
downloader.downloadImagesAtKey(key_name='name of image key', folder_name='folder name')
Fields
| field | type | Default | description |
|---|---|---|---|
| map | dict |
None |
json response |
| folder_name | str |
images |
name of the folder where your images are saved |
| image_format | ImageFormat |
ImageFormat.jpg |
format to save the image ie. png, jpg, jpeg |
Features
- Download all network images referenced from a json file
- Rename image json with names of local images on the pc
Metadata
Release files for api-clone 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| api_clone-0.0.2.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| api_clone-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / api_clone-0.0.2.tar.gz
| Download URL | api_clone-0.0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b98afb192a6e4d2c4eff56e8da3b2f12fa19e1433a5278b1b3e8ad9aa724447
|
|
BLAKE2b-256 checksum How to use checksums |
3a71b46724cdfb79a73e05562e846a4543f179e1ba5ddfb0e40eafc4313213d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / api_clone-0.0.2-py3-none-any.whl
| Download URL | api_clone-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f991ec760246e3ead8b4e7c275c6c55c8be745fba6ee9c92d92747abfebd8954
|
|
BLAKE2b-256 checksum How to use checksums |
b9a26ee82f23e39c90df1d2da3fefd8a8dd040c7f60bf58dd680c5b474477c9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|