When I use the Python requests module for the following HTTP request, it returns a dict of exactly what I need:
import requests
payload = {'x-algolia-application-id':'Q0TMLOPF1J','x-algolia-api-key':'30a0c84a152d179ea8aa1a7a59374d08', 'hitsPerPage':'40', 'numericFilters': ['startdate > 1511095966851'],'facets': '*' }
url = 'https://q0tmlopf1j-3.algolianet.com/1/indexes/sitecore-events'
r = requests.get(url, params=payload).json()
However when I instead try to implement this as a scrapy Request so I can parse the results:
def start_requests(self):
payload = {'x-algolia-application-id':'Q0TMLOPF1J','x-algolia-api-key':'30a0c84a152d179ea8aa1a7a59374d08', 'hitsPerPage':'40', 'numericFilters': ['startdate > 1511095966851'],'facets': '*' }
url = 'https://q0tmlopf1j-3.algolianet.com/1/indexes/sitecore-events'
yield scrapy.Request(url,
body=json.dumps(payload),
method='GET',
callback=self.parse_item)
def parse_item(self,response):
# I want to parse the dict here
I get a 403 error. I know there is something simple I am doing wrong, what is it?