Reference¶
Bring API package.
Bring
¶
Unofficial Bring API interface.
Init function for Bring API.
Source code in bring_api/bring.py
login
async
¶
Try to login.
Returns:
Type | Description |
---|---|
Response
|
The server response object. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the login fails due invalid credentials. You should check your email and password. |
Source code in bring_api/bring.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
reload_user_list_settings
async
¶
reload_article_translations
async
¶
Reload the article translations.
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
load_lists
async
¶
Load all shopping lists.
Returns:
Type | Description |
---|---|
BringListResponse
|
The JSON response. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
get_list
async
¶
Get all items from a shopping list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
A list uuid returned by load_lists() |
required |
Returns:
Type | Description |
---|---|
BringItemsResponse
|
The JSON response. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
get_all_item_details
async
¶
Get all details from a shopping list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
A list uuid returned by load_lists() |
required |
Returns:
Type | Description |
---|---|
BringListItemsDetailsResponse
|
The JSON response. A list of item details. Caution: This is NOT a list of the items currently marked as 'to buy'. See get_list() for that. This contains the items that where customized by changing their default icon, category or uploading an image. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
save_item
async
¶
Save an item to a shopping list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
A list uuid returned by load_lists() |
required |
item_name
|
str
|
The name of the item you want to save. |
required |
specification
|
str
|
The details you want to add to the item. |
''
|
item_uuid
|
str
|
The uuid for the item to add. If a unique identifier is required it is recommended to generate a random uuid4. |
None
|
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
Source code in bring_api/bring.py
update_item
async
¶
Update an existing list item.
Caution: Do not update item_name
. Providing item_uuid
makes it
possible to update a specific item in case there are multiple
items with the same name. If uuid is not specified, the newest
item with the given item_name
will be updated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
A list uuid returned by load_lists() |
required |
item_name
|
str
|
The name of the item you want to update. |
required |
specification
|
str
|
The details you want to update on the item. |
''
|
item_uuid
|
str
|
The uuid of the item to update. |
None
|
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
Source code in bring_api/bring.py
remove_item
async
¶
Remove an item from a shopping list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
A list uuid returned by load_lists() |
required |
item_name
|
str
|
The name of the item you want to remove. |
required |
item_uuid
|
str
|
The uuid of the item you want to remove. The item to remove can be remove by only referencing its uuid and setting item_name to any nonempty string. |
None
|
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
Source code in bring_api/bring.py
complete_item
async
¶
Complete an item from a shopping list. This will add it to recent items.
If it was not on the list, it will still be added to recent items.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
A list uuid returned by load_lists() |
required |
item_name
|
str
|
The name of the item you want to complete. |
required |
specification
|
str
|
The details you want to update on the item. |
''
|
item_uuid
|
str
|
The uuid of the item you want to complete. |
None
|
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
Source code in bring_api/bring.py
notify
async
¶
Send a push notification to all other members of a shared list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
The unique identifier of the list. |
required |
notification_type
|
BringNotificationType
|
The type of notification to be sent. |
required |
item_name
|
str
|
The name of the item. Required if notification_type is URGENT_MESSAGE. |
None
|
activity
|
str | Activity | None
|
The UUID or the Activity object of the activity to react to. Required if notification_type is LIST_ACTIVITY_STREAM_REACTION. |
None
|
receiver
|
str | None
|
The public user UUID of the recipient. Required if notification_type is LIST_ACTIVITY_STREAM_REACTION and activity is referenced by it's uuid. |
None
|
activity_type
|
ActivityType | None
|
Required if notification_type is LIST_ACTIVITY_STREAM_REACTION and activity is referenced by it's uuid. |
None
|
reaction
|
ReactionType | None
|
The type of reaction. Either :MONOCLE:, :THUMBS_UP:, :HEART:, or :DROOLING: Required if notification_type is LIST_ACTIVITY_STREAM_REACTION. |
None
|
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
TypeError
|
If the notification_type parameter is invalid. |
ValueError
|
If the value for item_name, receiver, activity, activity_type, or reaction is invalid. |
Source code in bring_api/bring.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 |
|
does_user_exist
async
¶
Check if e-mail is valid and user exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mail
|
str
|
An e-mail address. |
None
|
Returns:
Type | Description |
---|---|
bool
|
True if user exists. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringEMailInvalidException
|
If the email is invalid. |
BringUserUnknownException
|
If the user is does not exist |
Source code in bring_api/bring.py
__load_article_translations_from_file
¶
Read localization ressource files from disk.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
locale
|
str
|
A locale string |
required |
Returns:
Type | Description |
---|---|
dict[str, str]:
|
A translation table as a dict |
Source code in bring_api/bring.py
__load_article_translations
async
¶
Load all required translation dictionaries into memory.
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
Returns:
Type | Description |
---|---|
dict
|
dict of downloaded dictionaries |
Source code in bring_api/bring.py
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 |
|
__translate
¶
Translate a catalog item from or to a language.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item_id
|
str
|
Item name. |
required |
to_locale
|
str
|
locale to translate to. |
None
|
from_locale
|
str
|
locale to translate from. |
None
|
Returns:
Type | Description |
---|---|
str
|
Translated Item name. |
Raises:
Type | Description |
---|---|
BringTranslationException
|
If the translation fails. |
Source code in bring_api/bring.py
__load_user_list_settings
async
¶
Load user list settings into memory.
Raises:
Type | Description |
---|---|
BringTranslationException
|
If the user list settings could not be loaded. |
Returns:
Type | Description |
---|---|
dict[str, dict[str, str]]
|
A dict of settings of the users lists |
Source code in bring_api/bring.py
get_all_user_settings
async
¶
Load all user settings and user list settings.
Returns:
Type | Description |
---|---|
BringUserSettingsResponse
|
The JSON response. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseExceptiontry:
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
__locale
¶
Get list or user locale.
Returns:
Type | Description |
---|---|
str
|
The locale from userlistsettings or user. |
Raises:
Type | Description |
---|---|
BringTranslationException
|
If list locale could not be determined from the userlistsettings or user. |
Source code in bring_api/bring.py
map_user_language_to_locale
¶
Map user language to a supported locale.
The userLocale returned from the user account settings is not necessarily one of the 20 locales used by the Bring App but rather what the user has set as language on their phone and the country where they are located. Usually the locale for the lists is always returned from the bringusersettings API endpoint. One exception exists, when user onboarding happens through the webApp, then the locale for the automatically created initial list is not set. For other lists this does not happen, as it is not possible to create more lists in the webApp, only in the mobile apps.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_locale
|
dict
|
user locale as a dict containing |
required |
Returns:
Type | Description |
---|---|
str
|
The locale corresponding to the users language. |
Source code in bring_api/bring.py
get_user_account
async
¶
Get current user account.
Returns:
Type | Description |
---|---|
BringSyncCurrentUserResponse
|
The JSON response. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
batch_update_list
async
¶
Batch update items on a shopping list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
The listUuid of the list to make the changes to |
required |
items
|
BringItem or List of BringItem
|
Item(s) to add, complete or remove from the list |
required |
operation
|
BringItemOperation
|
The Operation (ADD, COMPLETE, REMOVE) to perform for the supplied items on the list. Parameter can be ommited, and the BringItem key 'operation' can be set to TO_PURCHASE, TO_RECENTLY or REMOVE. Defaults to BringItemOperation.ADD if operation is neither passed as parameter nor is set in the BringItem. |
None
|
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
retrieve_new_access_token
async
¶
Refresh the access token.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
refresh_token
|
str
|
The refresh token to use to retrieve a new access token |
None
|
Returns:
Type | Description |
---|---|
BringAuthTokenRespone
|
The JSON response. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringAuthException
|
If the request fails due to invalid or expired refresh token. |
Source code in bring_api/bring.py
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 |
|
set_list_article_language
async
¶
Set the article language for a specified list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
list_uuid
|
str
|
The unique identifier for the list. |
required |
language
|
str
|
The language to set for the list articles. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the specified language is not supported. |
BringRequestException
|
If the request fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
get_activity
async
¶
Get activity for given list.
Source code in bring_api/bring.py
get_list_users
async
¶
Retrieve members of a shared list.
Source code in bring_api/bring.py
parse_recipe
async
¶
Parse a recipe from a URL into a BringTemplate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recipe_url
|
str
|
The URL of the recipe to be parsed. |
required |
Returns:
Type | Description |
---|---|
BringTemplate
|
An instance of BringTemplate representing the parsed recipe. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
create_template
async
¶
Create a new template or recipe in Bring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template
|
BringTemplate
|
An instance of BringTemplate containing the template or recipe details to be created. |
required |
template_type
|
TemplateType
|
The type of template to be created. It can be either a standard template or a recipe. |
TEMPLATE
|
Returns:
Type | Description |
---|---|
BringTemplate
|
An instance of BringTemplate representing the created template. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
delete_template
async
¶
Delete a template or recipe by its UUID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_uuid
|
str
|
The unique identifier of the template or recipe to be deleted. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
get_inspirations
async
¶
Get inspirations (recipes/templates) for a given tag from Bring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter
|
str
|
The tag to filter inspirations by. Default is "mine".
Possible filter tags: all, mine, bring_trending_recipes, chefkoch.de
Other promotional filter tags are available depending on the season
and can be retrieved with |
'mine'
|
Returns:
Type | Description |
---|---|
BringInspirationsResponse
|
A response object containing the inspirations data. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
get_inspiration_filters
async
¶
Retrieve categories (filters) for the inspiration stream.
Returns:
Type | Description |
---|---|
BringInspirationFiltersResponse
|
An instance of BringInspirationFiltersResponse containing the filters. |
Raises:
Type | Description |
---|---|
BringRequestException
|
If the request fails. |
BringParseException
|
If the parsing of the request response fails. |
BringAuthException
|
If the request fails due to invalid or expired authorization token. |
Source code in bring_api/bring.py
BringAuthException
¶
Bases: BringException
When an authentication error is encountered.
BringEMailInvalidException
¶
Bases: BringException
When checkemail returns emailValid false .
BringParseException
¶
Bases: BringException
When parsing the response of a request fails.
BringRequestException
¶
Bases: BringException
When the HTTP request fails.
BringTranslationException
¶
Bases: BringException
When translating an article fails.
BringUserUnknownException
¶
Bases: BringException
When checkemail returns userExists false.
Activity
dataclass
¶
Bases: DataClassORJSONMixin
An activity entry.
Attribute
dataclass
¶
Bases: DataClassORJSONMixin
An attribute class. Represents a single item attribute.
BringActivityResponse
dataclass
¶
Bases: DataClassORJSONMixin
A list activity.
BringAuthResponse
dataclass
¶
Bases: DataClassORJSONMixin
An auth response class.
BringAuthTokenResponse
dataclass
¶
Bases: DataClassORJSONMixin
A refresh token response class.
BringErrorResponse
dataclass
¶
Bases: DataClassORJSONMixin
Error resonse class.
BringInspirationFiltersResponse
dataclass
¶
Bases: BaseModel
Bring inspiration filters response.
BringInspirationsResponse
dataclass
¶
Bases: BaseModel
Bring inspirations response.
BringItemsResponse
dataclass
¶
Bases: DataClassORJSONMixin
An items response class.
BringList
dataclass
¶
Bases: DataClassORJSONMixin
A list class. Represents a single list.
BringListItemDetails
dataclass
¶
Bases: DataClassORJSONMixin
An item details class.
Includes several details of an item in the context of a list. Caution: This does not have to be an item that is currently marked as 'to buy'.
BringListItemsDetailsResponse
dataclass
¶
Bases: DataClassORJSONMixin
A response class of a list of item details.
BringListResponse
dataclass
¶
Bases: DataClassORJSONMixin
A list response class.
BringNotificationType
¶
Bases: StrEnum
Notification type.
GOING_SHOPPING: "I'm going shopping! - Last chance for adjustments" CHANGED_LIST: "List changed - Check it out" SHOPPING_DONE: "Shopping done - you can relax" URGENT_MESSAGE: "Breaking news - Please get {itemName}! LIST_ACTIVITY_STREAM_REACTION: React with 🧐, 👍🏼, 🤤 or 💜 to activity
BringPurchase
dataclass
¶
Bases: DataClassORJSONMixin
A purchase class. Represents a single item.
BringSyncCurrentUserResponse
dataclass
¶
Bases: DataClassORJSONMixin
A sync current user response class.
BringTemplate
dataclass
¶
Bases: BaseModel
Bring recipe.
BringUser
dataclass
¶
A Bring user.
BringUserListSettingEntry
dataclass
¶
Bases: DataClassORJSONMixin
A user list settings class. Represents a single list setting.
BringUserSettingsEntry
dataclass
¶
Bases: DataClassORJSONMixin
A user settings class. Represents a single user setting.
BringUserSettingsResponse
dataclass
¶
Bases: DataClassORJSONMixin
A user settings response class.
BringUsersResponse
dataclass
¶
Bases: DataClassORJSONMixin
List users.
Content
dataclass
¶
Bases: DataClassORJSONMixin
A content class. Represents a single item content.
Inspiration
dataclass
¶
Bases: BaseModel
Inspiration entry.
InspirationFilter
dataclass
¶
Bases: BaseModel
Inspiration filter.
Items
dataclass
¶
Bases: DataClassORJSONMixin
An items class.
PremiumConfiguration
dataclass
¶
Bases: DataClassORJSONMixin
A premium configuration class.
UserLocale
dataclass
¶
Bases: DataClassORJSONMixin
A user locale class.