-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_calls_to_update_db.py
146 lines (129 loc) · 4.81 KB
/
api_calls_to_update_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import requests
# Base URL of your Next.js application
BASE_URL = "http://localhost:3000/api"
def create_domain(domain_data):
response = requests.post(f"{BASE_URL}/domains", json=domain_data)
print_response_info(response)
return response.json() if response.ok else None
def create_availability_status(status_data):
response = requests.post(f"{BASE_URL}/availability-status", json=status_data)
print_response_info(response)
return response.json() if response.ok else None
def create_evaluation(evaluation_data):
response = requests.post(f"{BASE_URL}/evaluation", json=evaluation_data)
print_response_info(response)
return response.json() if response.ok else None
def create_seo_analysis(seo_data):
response = requests.post(f"{BASE_URL}/seo-analysis", json=seo_data)
print_response_info(response)
return response.json() if response.ok else None
def print_response_info(response):
print("--------------------------------")
print(f"Status Code: {response.status_code}")
print(f"Response Content: {response.text}")
# Example usage:
new_domain = {
"domainName": "example3.com",
"tld": "com",
"length": 8,
"processedByAgent": "Agent1",
"agentModel": "Model1"
}
created_domain = create_domain(new_domain)
print("Created domain:", created_domain)
if created_domain:
domain_id = created_domain['id']
new_availability_status = {
"domainId": domain_id,
"status": "Available",
"processedByAgent": "bot-323",
"agentModel": "ModelX"
}
created_availability_status = create_availability_status(new_availability_status)
print("Created availability status:", created_availability_status)
new_evaluation = {
"domainId": domain_id,
"possibleCategories": ["tech", "business"],
"possibleKeywords": ["innovation", "growth"],
"memorabilityScore": 8,
"pronounceabilityScore": 7,
"brandabilityScore": 9,
"description": "Strong brand potential",
"processedByAgent": "agent-001",
"agentModel": "ModelX"
}
# Note: overallScore is not included here as it will be calculated on the server
created_evaluation = create_evaluation(new_evaluation)
print("Created evaluation:", created_evaluation)
new_seo_analysis = {
"domainId": domain_id,
"seoKeywords": ["seo", "analysis"],
"seoKeywordRelevanceScore": 8,
"industryRelevanceScore": 7,
"domainAge": 2,
"potentialResaleValue": 1000,
"language": "English",
"trademarkStatus": "Pending",
"scoredByAgent": "agent-001",
"agentModel": "ModelX",
"description": "SEO analysis description"
}
created_seo_analysis = create_seo_analysis(new_seo_analysis)
print("Created SEO analysis:", created_seo_analysis)
# Example of creating multiple domains
new_domains = [
{
"domainName": "example1.com",
"tld": "com",
"length": 8,
"processedByAgent": "Agent1",
"agentModel": "Model1"
},
{
"domainName": "example2.com",
"tld": "com",
"length": 8,
"processedByAgent": "Agent2",
"agentModel": "Model2"
}
]
for domain_data in new_domains:
created_domain = create_domain(domain_data)
print(f"Created domain: {created_domain}")
if created_domain:
domain_name = domain_data['domainName']
domain_id = created_domain['id']
# Create related records for each domain
availability_status = create_availability_status({
"domainId": domain_id,
"status": "Available",
"processedByAgent": "bot-323",
"agentModel": "ModelX"
})
print(f"Created availability status for {domain_name}: {availability_status}")
evaluation = create_evaluation({
"domainId": domain_id,
"possibleCategories": ["tech", "business"],
"possibleKeywords": ["innovation", "growth"],
"memorabilityScore": 8,
"pronounceabilityScore": 7,
"brandabilityScore": 9,
"description": "Strong brand potential",
"processedByAgent": "agent-001",
"agentModel": "ModelX"
})
print(f"Created evaluation for {domain_name}: {evaluation}")
seo_analysis = create_seo_analysis({
"domainId": domain_id,
"seoKeywords": ["seo", "analysis"],
"seoKeywordRelevanceScore": 8,
"industryRelevanceScore": 7,
"domainAge": 2,
"potentialResaleValue": 1000,
"language": "English",
"trademarkStatus": "Pending",
"scoredByAgent": "agent-001",
"agentModel": "ModelX",
"description": "SEO analysis description"
})
print(f"Created SEO analysis for {domain_name}: {seo_analysis}")