Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
This library is essentially an async "wrapper" (not really wrapping anything, but not sure what better term to use) of the google-maps-services-python library
It includes all APIs used in google-maps-services-python
async_googlemaps.AsyncClient
object, an aiohttp.ClientSession
object is a required argument.googlemaps.Client
has an optional parameter, requests_session
, which is the synchronous version.aiohttp
, you should go read the Client quickstart guide
in the aiohttp docsEach Google Maps Web Service request requires an API key or client ID. API keys are generated in the 'Credentials' page of the 'APIs & Services' tab of Google Cloud console.
For even more information on getting started with Google Maps Platform and generating/restricting an API key, see Get Started with Google Maps Platform in our docs.
Important: This key should be kept secret on your server.
$ pip install -U async_googlemaps
There are basically two ways to create the async_googlemaps.AsyncClient
These examples use the Geocoding API and the Directions API with an API key:
aiohttp.ClientSession
that will be passed to the
async_googlemaps.AsyncClient
from async_googlemaps import AsyncClient
import aiohttp
from datetime import datetime
async def main():
async with aiohttp.ClientSession() as maps_session:
gmaps = AsyncClient(maps_session, key='Add Your Key here')
# Then use the APIs just as you would with the synchronous version,
# but with an await keyword prefacing the method
# Geocoding an address
geocode_result = await gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')
# Look up an address with reverse geocoding
reverse_geocode_result = await gmaps.reverse_geocode((40.714224, -73.961452))
# Request directions via public transit
now = datetime.now()
directions_result = await gmaps.directions("Sydney Town Hall",
"Parramatta, NSW",
mode="transit",
departure_time=now)
aiohttp.ClientSession
object without a context-manager, and manually close the ClientSession.from async_googlemaps import AsyncClient
import aiohttp
async def main():
session = aiohttp.ClientSession()
gmaps = AsyncClient(session, key='Add Your Key here')
# Geocoding an address
geocode_result = await gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')
reverse_geocode_result = await gmaps.reverse_geocode((40.714224, -73.961452))
# aio_client must be closed manually
await session.close()
Automatically retry when intermittent failures occur. That is, when any of the retriable 5xx errors are returned from the API.
Documentation for the google-maps-services-python
library
FAQs
Asynchronous Python client library for Google Maps Platform
We found that async-googlemaps demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.