Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Error 403: Forbidden #16

Open
tanwimallick opened this issue Jun 19, 2019 · 4 comments
Open

HTTP Error 403: Forbidden #16

tanwimallick opened this issue Jun 19, 2019 · 4 comments

Comments

@tanwimallick
Copy link

Smopy is not working. Getting the error HTTP Error 403: Forbidden while calling smopy.Map.

@rossant
Copy link
Owner

rossant commented Jun 19, 2019

Yes, a push was fixed a few days ago, could you install the latest version?

@tanwimallick
Copy link
Author

Smopy is not working again. Getting HTTP Error 429: Too Many Requests

@VikingScientist
Copy link

I am getting the same error

Lowered zoom level to keep map size reasonable. (z = 15)
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
<ipython-input-2-f4c3d678136e> in <module>
----> 1 I = smopy.Map((63.300, 10.47, 63.320, 10.48))

/usr/local/lib/python3.6/dist-packages/smopy.py in __init__(self, *args, **kwargs)
    290         self.ymin = min(self.box_tile[1], self.box_tile[3])
    291         self.img = None
--> 292         self.fetch()
    293 
    294     def to_pixels(self, lat, lon=None):

/usr/local/lib/python3.6/dist-packages/smopy.py in fetch(self)
    322         """Fetch the image from OSM's servers."""
    323         if self.img is None:
--> 324             self.img = fetch_map(self.box_tile, self.z)
    325         self.w, self.h = self.img.size
    326         return self.img

/usr/local/lib/python3.6/dist-packages/smopy.py in fetch_map(box, z)
     63         for y in range(y0, y1 + 1):
     64             px, py = TILE_SIZE * (x - x0), TILE_SIZE * (y - y0)
---> 65             img.paste(fetch_tile(x, y, z), (px, py))
     66     return img
     67 

/usr/local/lib/python3.6/dist-packages/smopy.py in fetch_tile(x, y, z)
     43     """
     44     url = get_url(x, y, z)
---> 45     png = BytesIO(urlopen(url).read())
     46     img = Image.open(png)
     47     img.load()

/usr/lib/python3.6/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    221     else:
    222         opener = _opener
--> 223     return opener.open(url, data, timeout)
    224 
    225 def install_opener(opener):


...


HTTPError: HTTP Error 429: Too Many Requests

@VikingScientist
Copy link

Sorry... this was when using smopy as it appears on PyPi; version 0.0.6. When checking out the source code (version 0.0.7) it the error was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants