rrwen/google_streetview

Pick-up Download Images at Request Time Out

ap266 opened this issue · 1 comments

ap266 commented

Purpose

Hello, I'm using the api to download ~16k Google Street View photos and around photo 4500 the request timed out. How can I continue downloading from where the request timed out without having to reload the params, from the timed out point, onto the results again.

Example

params is ab 16k

results = google_streetview.api.results(params)
results.links[4176:].download_links('balt_streetview_downloads')

I want to pick up downloading photos from number 4176. The above doesn't work because results.links is a list and .download_links works on the results. object only.

Notes

rrwen commented

@ap266 Thanks for describing the problem! I should develop a retry and fault-tolerant method for download_links.

🔧 In the meantime, you could save the links with save_links and use requests and shutil to download and retry them from a particular line if they fail:

  1. Read the saved links from file line by line
  2. Make reference to current line
  3. If download fails:
    • Try the current line again until all lines have been read

❗ This package uses the requests and shutil libraries as well, and you are welcome to use the function at 📃 Line 74 to 79 in helpers.py!