Closed soedjais closed 6 years ago
I'm doing this:
def callback(index, response, **kwargs):
response.image_index = index
rs = [
grequests.get(
url,
timeout=IMG2_TIMEOUT,
callback=partial(callback, index)
)
for index, url in enumerate(urls)
]
Very smart. Thank you.
What would be the official way of associating a context data (e.g. dictionary, list, etc) to a request in a way so that it can be referred later from a response object? I used to maintain it myself, and then passed an id as a header value, which later retrieved from response.request.header. But that meant the id got sent to destination server. It would be nice if we could have some place to store data related to request but not actually sent anywhere. Thanks!