sky-api-client 3.3.12__tar.gz → 3.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/PKG-INFO +1 -1
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/setup.py +1 -1
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/client.py +15 -7
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/exceptions/exception.py +4 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client.egg-info/PKG-INFO +1 -1
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/README.md +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/pyproject.toml +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/setup.cfg +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/__init__.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/common/__init__.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/common/tasks/__init__.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/common/tasks/asyncio.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/__init__.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/action.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/action_custom_field.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/action_status.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/address.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/alias.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/base.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/code_table.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_address.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_alias.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_code.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_custom_field.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_education.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_email_address.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_online_presence.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_phone.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_relationship.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_solicit_code.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/custom_field.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/custom_field_categories.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/education.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/email_addresses.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_fee.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participant.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participant_donation.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participant_fee.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participant_fee_payment.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participant_levels.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participation_levels.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/fundraising_appeal.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/fundraising_campaign.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/fundraising_fund.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/fundraising_package.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gender.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift_aid.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift_batch.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift_batch_gift.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift_batch_gift_v2.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift_custom_field_values.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift_custom_fields.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift_subtype.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/list.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/online_presence.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/phone.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/registry.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/relationship.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/solicit_code.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/suffix.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/table_entry.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/title.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/webhook_subscription.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/exceptions/__init__.py +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client.egg-info/SOURCES.txt +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client.egg-info/dependency_links.txt +0 -0
- {sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import random
|
|
1
2
|
import time
|
|
2
3
|
from typing import Dict, Any
|
|
3
4
|
import requests
|
|
4
5
|
from sky_api_client.entity.base import Entity
|
|
5
6
|
from sky_api_client.entity.registry import EntityRegistry
|
|
6
|
-
from sky_api_client.exceptions.exception import GeneralError
|
|
7
|
+
from sky_api_client.exceptions.exception import GeneralError, RateLimitError
|
|
7
8
|
|
|
8
9
|
BASE_URL = 'https://api.sky.blackbaud.com'
|
|
9
10
|
DEFAULT_TIMEOUT = 300
|
|
11
|
+
DEFAULT_RETRIES = 3
|
|
12
|
+
MAX_RETRY_AFTER_SECONDS = 60
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
class SkyApiClient(object):
|
|
@@ -14,7 +17,9 @@ class SkyApiClient(object):
|
|
|
14
17
|
self.subscription_key = subscription_key
|
|
15
18
|
self.access_token = access_token
|
|
16
19
|
|
|
17
|
-
def request(
|
|
20
|
+
def request(
|
|
21
|
+
self, method: str, path: str, data: Dict[str, str] = None, params: Dict[str, Any] = None, retry_count: int = 0
|
|
22
|
+
):
|
|
18
23
|
response = requests.request(
|
|
19
24
|
method=method,
|
|
20
25
|
url='{}/{}'.format(BASE_URL, path),
|
|
@@ -25,11 +30,14 @@ class SkyApiClient(object):
|
|
|
25
30
|
)
|
|
26
31
|
|
|
27
32
|
if response.status_code == 429:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
if retry_count >= DEFAULT_RETRIES:
|
|
34
|
+
raise RateLimitError('Rate limit exceeded after {} retries'.format(DEFAULT_RETRIES))
|
|
35
|
+
try:
|
|
36
|
+
sleep_seconds = int(response.headers.get('Retry-After', 3))
|
|
37
|
+
except (TypeError, ValueError):
|
|
38
|
+
sleep_seconds = 3
|
|
39
|
+
time.sleep(min(sleep_seconds, MAX_RETRY_AFTER_SECONDS) + random.uniform(0, 1))
|
|
40
|
+
return self.request(method, path, data=data, params=params, retry_count=retry_count + 1)
|
|
33
41
|
|
|
34
42
|
if response.ok:
|
|
35
43
|
try:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_custom_field.py
RENAMED
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_education.py
RENAMED
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_email_address.py
RENAMED
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_online_presence.py
RENAMED
|
File without changes
|
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_relationship.py
RENAMED
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/constituent_solicit_code.py
RENAMED
|
File without changes
|
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/custom_field_categories.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participant_donation.py
RENAMED
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participant_fee.py
RENAMED
|
File without changes
|
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participant_levels.py
RENAMED
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/event_participation_levels.py
RENAMED
|
File without changes
|
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/fundraising_campaign.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/gift_custom_field_values.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sky_api_client-3.3.12 → sky_api_client-3.4.0}/sky_api_client/entity/webhook_subscription.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|