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

Places v1 API not supported #144

Closed
gregbrowndev opened this issue Jul 2, 2024 · 2 comments
Closed

Places v1 API not supported #144

gregbrowndev opened this issue Jul 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@gregbrowndev
Copy link

Example

from aiogoogle import Aiogoogle
from aiogoogle.auth import ApiKey


async def main() -> None:
    google_places_key = "..."
    
    async with Aiogoogle(
        api_key=ApiKey(google_places_key)
    ) as aiogoogle:
        
        # Finds service: "place" "v1"
        results = await aiogoogle.list_api("places")
        print(results)
        
        # Throws error! 
        results = await aiogoogle.discover('places', 'v1')
        print(results)


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Output:

{'discoveryVersion': 'v1',
 'items': [{'description': '',
            'discoveryRestUrl': 'https://places.googleapis.com/$discovery/rest?version=v1',
            'documentationLink': 'https://mapsplatform.google.com/maps-products/#places-section',
            'icons': {'x16': 'https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png',
                      'x32': 'https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png'},
            'id': 'places:v1',
            'kind': 'discovery#directoryItem',
            'name': 'places',
            'preferred': True,
            'title': 'Places API (New)',
            'version': 'v1'}],
 'kind': 'discovery#directoryList'}


Not Found

Content:
{'code': 404,
 'message': 'Requested entity was not found.',
 'status': 'NOT_FOUND'}

Request URL:
https://www.googleapis.com/discovery/v1/apis/places/v1/rest
@omarryhan
Copy link
Owner

omarryhan commented Jul 2, 2024

Hi @gregbrowndev , in your .discover() call, can you try passing disco_doc_ver=2?
As far as I remember, some APIs only work with this param passed.

@omarryhan omarryhan added the bug Something isn't working label Jul 2, 2024
@omarryhan
Copy link
Owner

Please reopen if my recommendation above doesn't work, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants