Answer the question
In order to leave comments, you need to log in
How to ignore OLX API request limit?
When I execute this code, the OLX API tells me that my request limit has run out, does anyone know how to ignore this?
from unicodedata import category
import requests
from bs4 import BeautifulSoup as BS
import fake_useragent
headers = {
'Accept':'*/*',
'Host': 'www.olx.ua',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode ': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36',
'X-Platform-Type': 'mobile-html5',
'Authorization': 'Bearer 6c8bea54aaecbbabfcbdadf99feb845781026be5',
}
# файл с ссылками
with open('urls.txt') as f:
urls = f.readlines()
for url in urls:
if url:
r = requests.get(url, headers=headers)
soup = BS(r.text, 'lxml')
id = soup.find('span', class_='css-9xy3gn-Text')
print(id.text.replace('ID: ', ''))
number = r = requests.get(f'https://www.olx.ua/api/v1/offers/{id.text.replace("ID: ", "")}/limited-phones/', headers=headers)
print(number.text)
if number:
if number.json()['data']['phones']:
print(number.json()['data']['phones'][0])
category = soup.find_all('li', class_='css-7dfllt')[-1].text
print(category)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question