Skip to content

Commit

Permalink
randomly wait between requests to G maps api #64 #86
Browse files Browse the repository at this point in the history
  • Loading branch information
jotyGill committed Jan 14, 2018
1 parent 470efb6 commit 3d914cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist
deb_dist
.*
.python-version
openpyn/test.py
5 changes: 3 additions & 2 deletions openpyn/locations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import sys
from time import sleep
import random
import time


# takes server list outputs locations (each only once) the servers are in.
Expand All @@ -14,7 +15,7 @@ def get_unique_locations(list_of_servers):
# print(unique_locations)
for eachLocation in unique_locations:
geo_address_list = get_location_name(eachLocation)
sleep(0.1)
time.sleep(random.randrange(1, 5, 1)*0.1)
# geo_address_list = get_location_name(latitude=latitude, longitude=longitude)
resolved_locations.append(geo_address_list)
# print(resolved_locations)
Expand Down

0 comments on commit 3d914cc

Please sign in to comment.