]> git.openstreetmap.org Git - rails.git/blobdiff - lib/osm.rb
Merge pull request #4184 from AntonKhorev/print
[rails.git] / lib / osm.rb
index 73513c3ad6d6f305cc70601222cc0a007a4e95b0..6d945c4fe871250f404af3926a1813cfa7858881 100644 (file)
@@ -353,6 +353,13 @@ module OSM
     end
   end
 
+  # Raised when a rate limit is exceeded
+  class APIRateLimitExceeded < APIError
+    def status
+      :too_many_requests
+    end
+  end
+
   # Helper methods for going to/from mercator and lat/lng.
   class Mercator
     include Math
@@ -520,7 +527,7 @@ module OSM
 
   # Return the HTTP client to use
   def self.http_client
-    @http_client ||= Faraday.new
+    @http_client ||= Faraday.new(:request => { :timeout => 15 })
   end
 
   # Return the MaxMindDB database handle