парсер на python,выдаёт ошибку 403 forbidden
я написал код который парсит всю инфу о юзерах https://unsplash.com/napi/photos?per_page=12&page=1 и так до https://unsplash.com/napi/photos?per_page=12&page=23000 но на больших цифрах например https://unsplash.com/napi/photos?per_page=12&page=16000 выдаёт ошибку 403 forbidden но при смени ip он открывается
import requests
from bs4 import BeautifulSoup
import json
import csv
import time
from datetime import datetime
for j in range(23000):
time.sleep(1)
r = requests.get("https://unsplash.com/napi/photos?per_page=12&page=" + str(j),headers={"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36"})
data = r.json()
for i in range(len(data)):
try:
accepted_tos = data[i]['user']['accepted_tos']
bio = data[i]['user']['bio']
bio = str(bio).replace("\r\n", " ")
first_name = data[i]['user']['first_name']
id = data[i]['user']['id']
instagram_username = data[i]['user']['instagram_username']
last_name = data[i]['user']['last_name']
location = data[i]['user']['location']
name = data[i]['user']['name']
portfolio_url = data[i]['user']['portfolio_url']
total_collections = data[i]['user']['total_collections']
total_likes = data[i]['user']['total_likes']
total_photos = data[i]['user']['total_photos']
twitter_username = data[i]['user']['twitter_username']
updated_at = data[i]['user']['updated_at']
username = str(data[i]['user']['username'])
all_info = open('info.csv', mode='a+',encoding="utf-8")
info_writer = csv.writer(all_info, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
item = {"accepted_tos":str(accepted_tos),
"bio":str(bio),
"first_name":str(first_name),
"id":str(id),
"instagram_username":str(instagram_username),
"last_name":str(last_name),
"location": str(location),
"name":str(name),
"portfolio_url":str(portfolio_url),
"total_collections": str(total_collections),
"total_likes":str(total_likes),
"total_photos":str(total_photos),
"twitter_username":str(twitter_username),
"updated_at":str(updated_at),
"username":str(username)
}
info_writer.writerow([item['accepted_tos'],item['bio'],item["first_name"],item["id"],item['instagram_username'],item['last_name'],item['location'],item['name'],item['portfolio_url'],item["total_collections"],item['total_likes'],item['total_photos'],item['twitter_username'],item['updated_at'],item['username']])
all_info.close()
except:
print(j)
continue