mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Merge pull request #6403 from jbradberry/awxkit-from-json-connection
Add a connection kwarg to Page.from_json Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
ee4dcd2055
@ -166,13 +166,13 @@ class Page(object):
|
||||
return self.__class__
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, raw):
|
||||
def from_json(cls, raw, connection=None):
|
||||
resp = Response()
|
||||
data = json.dumps(raw)
|
||||
resp._content = bytes(data, 'utf-8')
|
||||
resp.encoding = 'utf-8'
|
||||
resp.status_code = 200
|
||||
return cls(r=resp)
|
||||
return cls(r=resp, connection=connection)
|
||||
|
||||
def page_identity(self, response, request_json=None):
|
||||
"""Takes a `requests.Response` and
|
||||
@ -283,7 +283,7 @@ class Page(object):
|
||||
json['results'] = []
|
||||
for page in paged_results:
|
||||
json['results'].extend(page)
|
||||
page = self.__class__.from_json(json)
|
||||
page = self.__class__.from_json(json, connection=self.connection)
|
||||
return page
|
||||
|
||||
def head(self):
|
||||
|
||||
@ -177,7 +177,7 @@ def parse_resource(client, skip_deprecated=False):
|
||||
}
|
||||
_filter = 'key, value'
|
||||
formatted = format_response(
|
||||
Page.from_json(response),
|
||||
Page.from_json(response, connection=client.root.connection),
|
||||
fmt=client.get_config('format'),
|
||||
filter=_filter
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user