Package: open-groceries
open-groceriesUnified data acquisition across multiple grocery store sitesInstallationpython3-mpipinstallopen-groceriesExample Usagefromopen_groceriesimportOpenGrocery# Initialize adapter clientsclient=OpenGrocery()# Print locations near Times Squareprint(client.locations("Times Square NYC"))# Print search results for "beans"print(client.search("beans"))# Print search suggestions for "pot"print(client.suggest("pot"))API DocumentationOpenGrocery:The OpenGrocery class is an aggregator for all included adapters. Function/constructor signatures are as follows:OpenGrocery(features = ..., user_agent = ..., adapter_kwargs = ...)features: Optionalstr[], list of adapter names to initialize.user_agent: Optionalstr, user-agent string to pass to APIs.adapter_kwargs: Optional{str: {str: any}}, mapping ofadapter:{kwargs}for individual adapter kwargsOpenGrocery().locations(near, include = ...) -> Location[]: Fetches locations near an addressnear: Requiredstr, address to query.Example formats:"14620","Times Square NYC","Rochester Institute of Technology"include: Optionalstr[], list of adapters to query. Skips any that aren't initializedReturnsLocation[]in order of distance to specified addressOpenGrocery().set_nearest_stores(near, include = ...) -> None: Sets each adapter to its nearest storenear: Requiredstr, address to query.Example formats:"14620","Times Square NYC","Rochester Institute of Technology"include: Optionalstr[], list of adapters to query. Skips any that aren't initializedOpenGrocery().set_locations(locations) -> None: Sets each adapter to a specific storelocations: Required{str: Location}, mapping of adapter name to desired location. This function does not check whether the input location is valid for that adapter.OpenGrocery().search(query, include = ...) -> GroceryItem[]: Searches adapters for a search queryquery: Requiredstr, search term to look forinclude: Optionalstr[], list of adapters to query. Skips any that aren't initializedReturnsGroceryItem[]in order of similarity to the search termOpenGrocery().adapter(adapter) -> GroceryAdapter | None: Utility function to return an initialized adapteradapter: Requiredstr, name of adapter to getReturns specifiedGroceryAdapterif found, orNoneif notOpenGrocery().suggest(term, include = ...) -> str[]: Gets autocompletion suggestions to search termterm: Requiredstr, search term to suggest forinclude: Optionalstr[], list of adapters to query. Skips any that aren't initializedReturnsstr[]in order of similarity to search termGroceryAdapter:The GroceryAdapter class is the abstract parent of all included Adapters. It shoul not be initialized itself, but should instead be subclassed to create Adapters.GroceryAdapter(user_agent = ...)user_agent: Optionalstr, user agent header to send to APIsGroceryAdapter().search_groceries(search) -> GroceryItem[]: Search for groceriessearch: Requiredstr, search term to look forReturnsGroceryItem[]in the order returned by the websiteGroceryAdapter().get_grocery_item(id) -> GroceryItem: Gets a specific grocery item by IDid: Requiredstr, item ID to returnReturnsGroceryItemreturned by the websiteGroceryAdapter().get_locations(near) -> Location[]: Gets store locations near an addressnear: Requiredstr, address to query.Example formats:"14620","Times Square NYC","Rochester Institute of Technology"ReturnsLocation[]in the order returned by the websiteGroceryAdapter().set_location(location) -> None: Sets preferred store locationlocation: RequiredLocation, location to setGroceryAdapter().suggest(search) -> str[]: Gets autocomplete suggestions for a search termterm: Requiredstr, search term to suggest forReturnsstr[]in order returned by the websiteSupported StoresStoreItem SearchItem RetrievalLocation SearchLocation FilteringAutocompleteWegmansFull support [Long Term/Versioned API]Full support [Long Term/Versioned API]Full support [Medium Term/External Versioned API]Full Support [Long Term]Full support [Medium Term/External Versioned API]CostcoAdequate support [Medium Term/Site Parsing]Adequate support [Medium Term/Site Parsing]Full support [Medium Term/External Versioned API]Full Support [Long Term]Full support [Long Term/Versioned API]