simondlevy / GooMPy

Google Maps in Python
GNU Lesser General Public License v3.0
83 stars 26 forks source link

urllib.error.HTTPError: HTTP Error 403: Forbidden #6

Open geovogel opened 5 years ago

geovogel commented 5 years ago

Added my key to the file and got a Forbidden error when the example program tried to acess the Google Maps site.

ghost commented 5 years ago

I got the same error and I don't know why

nanopete2 commented 5 years ago

ditto

szotyi41 commented 5 years ago

Same

CesMak commented 5 years ago

Got the same error. Even without adding a key to the file are there any solutions yet?

On google I get: The Google Maps Platform server rejected your request. You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account

Actually You have to pay:

You must have a valid API key and a billing account to access our APIs. When you enable billing, you will get $200 free usage every month for Maps, Routes, or Places. Based on the millions of users using our APIs today, most of them can continue to use Google Maps Platform for free with this credit. Having a billing account helps us understand our developers’ needs better and allows you to scale seamlessly.

To avoid a service interruption to your projects, please visit our Get Started page to create a project, generate an API key, and enable a billing account. Once you generate and obtain an API key, make sure to update your application with the new API key.
ubx commented 4 years ago

` Index: goompy/init.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8

--- goompy/__init__.py  (date 1577375762637)
+++ goompy/__init__.py  (revision 74d264afa5fe4838657f7d7218e222c7f399eabd)
@@ -30,10 +30,9 @@

 import os
 import time

 try:
-    from goompy.key import _KEY
+    from key import _KEY
 except:
     _KEY = ''

@@ -57,7 +56,7 @@

 def _grab_tile(lat, lon, zoom, maptype, _TILESIZE, sleeptime):

-    urlbase = 'https://maps.googleapis.com/maps/api/staticmap?center=%f,%f&zoom=%d&maptype=%s&size=%dx%d&format=jpg&key='
+    urlbase = 'https://maps.googleapis.com/maps/api/staticmap?center=%f,%f&zoom=%d&maptype=%s&size=%dx%d&format=jpg'
     urlbase += _KEY

     specs = lat, lon, zoom, maptype, _TILESIZE, _TILESIZE

`

Aminnzh2020 commented 4 years ago

Hello

Thank you for the code. I have the same problem. Could you please guide me what should I do?

siyanhu commented 4 years ago

Hi when you're using goompy, you may need to modify the goompy.py (or in Pycharm, it's in site-packages/goompy/init.py). In function _grab_tile, you need to:

  1. comment "urlbase += _KEY"
  2. modify url base to: https://maps.googleapis.com/maps/api/staticmap?key=YOUR_API_KEY&center=%f,%f&zoom=%d&maptype=%s&size=%dx%d&format=jpg.

I've tested and it works. Enjoy.

irvan-k commented 3 years ago

i get this error and i cant solve this i do what you say but still not working @siyanhu

siyanhu commented 3 years ago

i get this error and i cant solve this i do what you say but still not working @siyanhu

May I see the code pls?