outscraper / outscraper-python

The library provides convenient access to the Outscraper API from applications written in the Python language. Allows using Outscraper's services from your code.
https://outscraper.com
MIT License
69 stars 18 forks source link

Static code analyzer cribbing about function return discrepancies #4

Closed lalitpagaria closed 3 years ago

lalitpagaria commented 3 years ago

I am integrating Outscrapper's Maps review API with Obsei. When I integrated SDK with Obsei, mypy started showing error about function return type. For example following function signature shows that they return dict -

def google_play_reviews(self, query: list, reviewsLimit: int = 100, sort: str = 'most_relevant', cutoff: int = None,
        rating: int = None, language: str = 'en'
    ) -> dict:

def google_maps_reviews(self, query: list, reviewsLimit: int = 100, limit: int = 1, sort: str = 'most_relevant',
        skip: int = 0, start: int = None, cutoff: int = None, cutoff_rating: int = None, ignore_empty: bool = False,
        coordinates: str = None, language: str = 'en', region: str = None
    ) -> dict:

But as per API docs and code they supposed to returning list -

        if 199 < response.status_code < 300:
            return self._wait_request_archive(response.json()['id']).get('data', [])

https://app.outscraper.com/api-docs#tag/Google-Maps/paths/~1maps~1reviews-v2/get

This mismatch causing static code checker to throw the error.

vlad-stack commented 3 years ago

Hello Lalit,

Thank you for the reporting on this. The fix is pushed into master and will be updated in the next SDK release. https://github.com/outscraper/google-maps-scraper-pyhton/pull/5

lalitpagaria commented 3 years ago

Thanks @vlad-outscraper for faster response. Closing this issue.