(endpoint, api_token=None, params=None, verbosity=0)
| 61 | |
| 62 | |
| 63 | def get_api_response(endpoint, api_token=None, params=None, verbosity=0): |
| 64 | if api_token is None: |
| 65 | api_token = get_api_token() |
| 66 | headers = { |
| 67 | "Authorization": f"Bearer {api_token}", |
| 68 | "Accept": "application/vnd.api+json", |
| 69 | "Content-Type": "application/json", |
| 70 | } |
| 71 | endpoint = endpoint.strip("/") |
| 72 | url = f"https://rest.api.transifex.com/{endpoint}" |
| 73 | if verbosity > 2: |
| 74 | print(f"\n>>> GET {url=} {params=}") |
| 75 | response = requests.get(url, headers=headers, params=params) |
| 76 | if verbosity > 2: |
| 77 | print(f">>>> GET {response=}\n") |
| 78 | response.raise_for_status() |
| 79 | return response.json()["data"] |
| 80 | |
| 81 | |
| 82 | def list_resources_with_updates( |
no test coverage detected