Code Samples: Using Magic-Summary in Python

Replace API key and content with your own

Please be sure to replace the placeholder API key with your API key and pass in your own strings for summarisation.

Using Requests

import requests
url = "https://beta.eu-north.computational-magic.com/api/v1"
headers = {'x-api-key': 'INSERT YOUR API KEY HERE!', 'Content-Type': 'application/json'}
query = """{summary(input: "INSERT YOUR LONG STRING HERE.")}"""
response = requests.post(url, headers=headers, json={'query': query})
print(response.status_code)
print(response.text)