Initial commit
This commit is contained in:
46
scraper_utilities/angolatesting.py
Normal file
46
scraper_utilities/angolatesting.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""
|
||||
Used for attempting to get data from angola-based websites.
|
||||
|
||||
"""
|
||||
|
||||
import requests
|
||||
import re
|
||||
import json
|
||||
from scrapy import Selector
|
||||
|
||||
|
||||
|
||||
xhr_headers = {
|
||||
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
||||
'content-type': 'application/json',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Connection': 'keep-alive',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/88.0',
|
||||
'x-algolia-api-key': 'YmE4MTVkMzc1YmU4ZDcxM2QxNTMzNDZlMzVlZjBjMTk4MmM5ZWU0NjBlN2I0NjE2NTk1M2VjZDg3MzQ1YjVmMXRhZ0ZpbHRlcnM9',
|
||||
'x-algolia-application-id': '3QIRNP5HAI'
|
||||
}
|
||||
|
||||
|
||||
url = 'https://3qirnp5hai-2.algolianet.com/1/indexes/*/queries?x-algolia-agent=Algolia for vanilla JavaScript (lite) 3.27.0;instantsearch.js 2.10.2;Magento2 integration (1.11.3);JS Helper 2.26.0'
|
||||
|
||||
# reqs = {
|
||||
# "query": "",
|
||||
# "hitsPerPage": 100,
|
||||
# "page": 0,
|
||||
# "filters": "product_published = 1 AND availability.displayProduct = 1"
|
||||
# }
|
||||
|
||||
reqs = {
|
||||
"requests": [
|
||||
{
|
||||
"indexName": "production_default_products_price_default_desc",
|
||||
"params": "query=&hitsPerPage=1000&filters=price.AUD.default < 500"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
r = requests.post(url, json.dumps(reqs), headers=xhr_headers)
|
||||
|
||||
with open("testing.json", "w") as f:
|
||||
f.write(r.text)
|
||||
Reference in New Issue
Block a user