import requests headers = { "X-API-Key": "", "X-API-Secret": "" } API_BASE_URL = "https://swissdox.linguistik.uzh.ch/api" API_URL_QUERY = f"{API_BASE_URL}/query" yaml_example = """ query: sources: - ZWA - ZWAS dates: - from: 2022-12-01 to: 2022-12-31 languages: - de - fr content: AND: - OR: - COVID - Corona - NOT: China - NOT: chin* result: format: TSV maxResults: 100 columns: - id - pubtime - medium_code - medium_name - rubric - regional - doctype - doctype_description - language - char_count - dateline - head - subhead - content_id - content version: 1.2 """ data = { "query": yaml_example, "test": "1", "name": "Query name 1", "comment": "Query comment", "expirationDate": "2023-02-28" } r = requests.post( API_URL_QUERY, headers=headers, data=data ) print(r.json())