Skip to content
This repository was archived by the owner on Apr 26, 2026. It is now read-only.

Commit 533d62a

Browse files
committed
added user agent to API request
1 parent f772af3 commit 533d62a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

Tool-22-Discord-Invite-Fetcher.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ def update_discord_servers_database():
124124
"../Database-Files/Main-Database/Compromised-Discord-Accounts.json"
125125
)
126126

127+
# Define headers with User-Agent
128+
headers = {
129+
"User-Agent": "DART Project - Discord Analytics for Risks & Threats (https://github.com/TheDARTProject)"
130+
}
131+
127132
database = load_database(db_file_path)
128133

129134
is_old_format = any(key.startswith("http") for key in database.keys())
@@ -139,10 +144,10 @@ def update_discord_servers_database():
139144
extract_invite_code(entry.get("INVITE_URL", "")) for entry in database.values()
140145
}
141146

142-
# Fetch data from API
143-
print(f"Fetching data from {api_url}...")
147+
# Fetch data from API with User-Agent header
148+
print(f"Fetching data from {api_url} with custom User-Agent...")
144149
try:
145-
response = requests.get(api_url)
150+
response = requests.get(api_url, headers=headers)
146151
response.raise_for_status()
147152
servers = response.json()
148153
print(f"Successfully fetched data: {len(servers)} servers found.")

0 commit comments

Comments
 (0)