i
Size: a a a
s
headers = {
'Content-Type': 'application/json;charset=UTF-8',
}
data = '{"currency":"USD"}'
import requests
response = requests.post('URL',
headers=headers, data=data)
print(response.text)
print(response.ok)
# Все работает, но переписатьна скрапи не могу
# builtins.ValueError: not enough values to unpack (expected 2, got 1)
return scrapy.FormRequest(
url='URL',
method="POST",
headers=headers,
formdata=data,
callback=self.after_check
)АН
АН
s
АН
class scrapy.http.Request(url[, callback, method='GET', headers, body, cookies, meta, encoding='utf-8', priority=0, dont_filter=False, errback, flags])
АН
body (str or unicode) – the request body. If a unicode is passed, then it’s encoded to str using the encoding passed (which defaults to utf-8). If body is not given, an empty string is stored. Regardless of the type of this argument, the final value stored will be a str (never unicode or None).