update headers

This commit is contained in:
MuslemRahimi 2024-07-27 15:05:01 +02:00
parent 11a06198f6
commit ac33cb54b9

View File

@ -38,8 +38,12 @@ existing_data = load_existing_data()
# Create a dictionary of existing posts for faster lookup and update # Create a dictionary of existing posts for faster lookup and update
existing_posts = {post['id']: post for post in existing_data} existing_posts = {post['id']: post for post in existing_data}
headers = {
'User-Agent': 'python:myapp:v1.0 (by /u/mrahimi114313)'
}
# Send a GET request to the API # Send a GET request to the API
response = requests.get(url, headers={'User-agent': 'Mozilla/5.0'}) response = requests.get(url, headers=headers)
counter = 0 counter = 0
# Check if the request was successful # Check if the request was successful