S
S
Sergey Alekseev2019-01-31 14:50:16
MySQL
Sergey Alekseev, 2019-01-31 14:50:16

Python-Requests how to resume connection?

Good afternoon, you need to download a large 10GB archive.
When I download 1 GB, I get ReadTimout.
Question: how to resume the connection after receiving such an execution?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rsa97, 2016-06-21
@mikediam

SELECT `s`.`user`, `u`.`name`, `s`.`OCI`, `s`.`OCO`, `s`.`CCP`, `s`.`PV`, `us`.`total_games`, 
       `s2`.`total_games` AS `today_games`, `s3`.`total_games` AS `yesterday_games`, 
       `s4`.`date` AS `high_OCI_date`
  FROM `qz_user_stat_date` AS `s` 
  JOIN `qz_users` AS `u` ON `u`.`id` = `s`.`user`
  JOIN `qz_user_stat` AS `us` ON `us`.`user` = `s`.`user`
  LEFT JOIN `qz_user_stat_date` AS `s2` ON `s2`.`user` = `s`.`user` AND `s2`.`date` = :today
  LEFT JOIN `qz_user_stat_date` AS `s3` ON `s3`.`user` = `s`.`user` AND `s3`.`date` = :yesterday
  LEFT JOIN (
    SELECT `t`.`user` AS `usr`, min(`t`.`date`) AS `date`
      FROM `qz_user_stat_date` AS `t`
      JOIN (
        SELECT `user`, max(`OCI`)  AS `oci`
          FROM `qz_user_stat_date` 
          GROUP BY `user`
      ) AS `o` ON `o`.`user` = `t`.`user` AND `o`.`oci` = `t`.`OCI`
      GROUP BY `t`.`user`
    ) AS `s4` ON `s4`.`usr` = `s`.`user`

A
Alex, 2016-06-21
@streetflush

Check for indexes.
Turn the last JOIN into a table.
And I hope user is of type int

V
Vladimir, 2019-01-31
@vintello

response = requests.get(url, stream=True)
handle = open(target_path, "wb")
for chunk in response.iter_content(chunk_size=512):
    if chunk:  # filter out keep-alive new chunks
        handle.write(chunk)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question