ap-test/common/obj.py

19 lines
552 B
Python
Raw Normal View History

# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
import os
import requests
from .logger import logger
def get_ap_obj(url):
logger.info(f"Getting object: {url}")
res = requests.get(url, headers={"Accept": "application/activity+json"})
msg = f"AP server response:\n\nSTATUS: {res.status_code}\n\nHEADERS:\n {res.headers}\n\nRESPONSE PAYLOAD:\n{res.text}"
logger.debug(msg)
assert res.status_code == 200, f"Request FAILURE. {msg}"
return res.json()