An script for saving json data and results locally on your machine
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file api_clone-0.0.2.tar.gz.
File metadata
- Download URL: api_clone-0.0.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b98afb192a6e4d2c4eff56e8da3b2f12fa19e1433a5278b1b3e8ad9aa724447
|
|
| MD5 |
2d335eb05d1256178290611f3e382cbd
|
|
| BLAKE2b-256 |
3a71b46724cdfb79a73e05562e846a4543f179e1ba5ddfb0e40eafc4313213d4
|
File details
Details for the file api_clone-0.0.2-py3-none-any.whl.
File metadata
- Download URL: api_clone-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f991ec760246e3ead8b4e7c275c6c55c8be745fba6ee9c92d92747abfebd8954
|
|
| MD5 |
81b615a833d789ad40e0a9824f2400ed
|
|
| BLAKE2b-256 |
b9a26ee82f23e39c90df1d2da3fefd8a8dd040c7f60bf58dd680c5b474477c9f
|