-1
我想解析來自網站的訂單。訂單通過ajax加載和請求看起來像:Scrapy多部分表單數據請求
-----------------------------1662842698634843362034232373 Content-Disposition: form-data; name="query" { orders(skip: 30, limit: 30, filter: {less3bids: false,withoutMyBids: false,title: "tests",contractual: true}) { total filtered orders { id type { id name } } } } -----------------------------1662842698634843362034232373--
我不明白如何需要發送請求。我想:
def after_login(self, content):
body = '''-----------------------------1662842698634843362034232373
Content-Disposition: form-data; name="query"
{
orders(skip: 30, limit: 30, filter: {less3bids: false,withoutMyBids: false,title: "tests",contractual: true}) {
total
filtered
orders {
id
type { id name }
}
}
}
-----------------------------1662842698634843362034232373--
'''
return scrapy.Request(
url="https://somesite.com/graphqlapi?",
method='POST',
body=body,
headers={
'Content-Type': 'multipart/form-data; boundary=---------------------------1662842698634843362034232373'
},
callback=self.parse_orders)
但現場返回錯誤:
Syntax Error GraphQL request (1:1) Unexpected <EOF>\n\n1: \n ^\n