Skip to content

Commit a28d891

Browse files
authored
Merge pull request #25 from ultradns/workflows
Workflows
2 parents 073f6bf + cc7ed36 commit a28d891

File tree

5 files changed

+25
-10
lines changed

5 files changed

+25
-10
lines changed

.github/workflows/pull_request.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
- master
66
jobs:
77
Code_Analysis_Job:
8+
if: ${{ ! github.event.pull_request.head.repo.fork }}
89
runs-on: ubuntu-latest
910
environment: test
1011
steps:
@@ -23,4 +24,4 @@ jobs:
2324
env:
2425
ULTRADNS_UNIT_TEST_USERNAME: ${{ secrets.ULTRADNS_UNIT_TEST_USERNAME }}
2526
ULTRADNS_UNIT_TEST_PASSWORD: ${{ secrets.ULTRADNS_UNIT_TEST_PASSWORD }}
26-
ULTRADNS_UNIT_TEST_HOST_URL: ${{ secrets.ULTRADNS_UNIT_TEST_HOST_URL }}
27+
ULTRADNS_UNIT_TEST_HOST_URL: ${{ secrets.ULTRADNS_UNIT_TEST_HOST_URL }}

.github/workflows/release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
- master
66
jobs:
77
Code_Analysis_Job:
8-
if: ${{ ! github.event.pull_request.head.repo.fork }}
98
runs-on: ubuntu-latest
109
environment: test
1110
steps:
@@ -50,6 +49,11 @@ jobs:
5049
-
5150
name: Creating python Package
5251
run: hatch build
52+
-
53+
name: create release Tag
54+
run: |
55+
git tag ${{ env.RELEASE_VERSION }}
56+
git push origin ${{ env.RELEASE_VERSION }}
5357
-
5458
name: Publishing python Package
5559
uses: pypa/[email protected]

.plugin-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.1
1+
2.2.2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ password = os.getenv('PASSWORD')
4949
if not username or not password:
5050
raise ValueError("Username and password must be set in environment variables.")
5151

52-
client = RestApiClient(your_username, your_password)
52+
client = RestApiClient(username, password)
5353

5454
domain = "udns-python-rest-client-test.com."
5555

ultra_rest_client/connection.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
# store the URL and the access/refresh tokens as state
99
import requests
10+
import time
1011
from .about import get_client_user_agent
1112

1213
class AuthError(Exception):
@@ -118,6 +119,10 @@ def _do_call(self, uri, method, params=None, body=None, retry=True, files=None,
118119
if response.status_code == requests.codes.NO_CONTENT:
119120
return {}
120121

122+
if response.status_code == requests.codes.TOO_MANY:
123+
time.sleep(1)
124+
return self._do_call(uri, method, params, body, False)
125+
121126
# some endpoints have no content-type header
122127
if 'content-type' not in response.headers:
123128
response.headers['content-type'] = 'none'
@@ -130,14 +135,19 @@ def _do_call(self, uri, method, params=None, body=None, retry=True, files=None,
130135
if response.headers.get('content-type') == 'application/zip':
131136
return response.content
132137

133-
json_body = response.json()
134-
# if this is a background task, add the task id (or location) to the body
135-
if response.status_code == requests.codes.ACCEPTED:
136-
json_body['task_id'] = response.headers.get('x-task-id')
138+
json_body = {}
139+
try:
140+
json_body = response.json()
141+
142+
# if this is a background task, add the task id (or location) to the body
143+
if response.status_code == requests.codes.ACCEPTED:
137144
if 'x-task-id' in response.headers:
138-
json_body['task_id'] = response.headers['x-task-id']
145+
json_body.update({"task_id": response.headers['x-task-id']})
139146
if 'location' in response.headers:
140-
json_body['location'] = response.headers['location']
147+
json_body.update({"location": response.headers['location']})
148+
149+
except requests.exceptions.JSONDecodeError:
150+
json_body = {}
141151

142152
if isinstance(json_body, dict) and retry and json_body.get('errorCode') == 60001:
143153
self._refresh()

0 commit comments

Comments
 (0)