ервый импорт проекта
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import json
|
||||
import requests
|
||||
|
||||
API_KEY = 'B3526FC8-82CB-4798-92C8-22AF05F9A49F'
|
||||
BASE_URL = 'https://support.atl-group.ru/api/v3'
|
||||
|
||||
import urllib3
|
||||
urllib3.disable_warnings()
|
||||
|
||||
# Get a ticket with attachments
|
||||
with open('migrations/scripts/extracted_data.json', 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
|
||||
# Find ticket with attachments
|
||||
for ticket in data['tickets']:
|
||||
if ticket.get('attachments'):
|
||||
tid = ticket['ticket_id']
|
||||
print(f'Getting details for ticket #{tid}...')
|
||||
|
||||
# Get full details from API
|
||||
url = f'{BASE_URL}/requests/{tid}'
|
||||
params = {'TECHNICIAN_KEY': API_KEY}
|
||||
|
||||
resp = requests.get(url, params=params, timeout=30, verify=False)
|
||||
full_data = resp.json()
|
||||
|
||||
if 'request' in full_data:
|
||||
req = full_data['request']
|
||||
|
||||
print(f'\nSubject: {req.get("subject", "")[:80]}')
|
||||
print(f'Description length: {len(req.get("description", ""))} chars')
|
||||
print(f'Has HTML in description: {"<" in req.get("description", "")}')
|
||||
|
||||
# Check conversations
|
||||
convs = req.get('conversations', [])
|
||||
print(f'\nConversations: {len(convs)}')
|
||||
if convs:
|
||||
print(f'First conversation keys: {list(convs[0].keys())}')
|
||||
print(f'First conversation sample:')
|
||||
conv = convs[0]
|
||||
print(f' From: {conv.get("from", {})}')
|
||||
print(f' To: {conv.get("to", [])}')
|
||||
print(f' Subject: {conv.get("subject", "")}')
|
||||
print(f' Type: {conv.get("type", "")}')
|
||||
print(f' Description length: {len(conv.get("description", ""))} chars')
|
||||
|
||||
# Check notes
|
||||
notes = req.get('notes', [])
|
||||
print(f'\nNotes: {len(notes)}')
|
||||
if notes:
|
||||
print(f'First note keys: {list(notes[0].keys())}')
|
||||
|
||||
# Check attachments
|
||||
attachments = req.get('attachments', [])
|
||||
print(f'\nAttachments: {len(attachments)}')
|
||||
if attachments:
|
||||
print(f'First attachment keys: {list(attachments[0].keys())}')
|
||||
print(f'First attachment: {json.dumps(attachments[0], ensure_ascii=False)[:500]}')
|
||||
|
||||
break
|
||||
Reference in New Issue
Block a user