juancarlospaco / faster-than-requests

Faster requests on Python 3
https://gist.github.com/juancarlospaco/37da34ed13a609663f55f4466c4dbc3e
MIT License
1.1k stars 89 forks source link

Is it possible to use a proxy with download ? #215

Closed Random-Code-Guy closed 1 year ago

Random-Code-Guy commented 1 year ago

Hi i have been using this with no issues and its been working perfect how ever i now need to use a http proxy when download files using this libery

i see a proxy is supported with the standard get but can it also be used with the download function as i dont see it in the documents ?

github-actions[bot] commented 1 year ago

Welcome Random-Code-Guy

BEP20 Binance Smart Chain Network BSC

0xb78c4cf63274bb22f83481986157d234105ac17e

BTC Bitcoin Network

1Pnf45MgGgY32X4KDNJbutnpx96E4FxqVi

Lightning Network

juancarlospaco@bitrefill.me

Ethereum ETH Dai DAI Uniswap UNI Axie Infinity AXS Smooth Love Potion SLP **BEP20 Binance Smart Chain Network BSC** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **ERC20 Ethereum Network** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ```
Tether USDT **BEP20 Binance Smart Chain Network BSC** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **ERC20 Ethereum Network** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **TRC20 Tron Network** ``` TWGft53WgWvH2mnqR8ZUXq1GD8M4gZ4Yfu ```
Solana SOL **BEP20 Binance Smart Chain Network BSC** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **SOL Solana Network** ``` FKaPSd8kTUpH7Q76d77toy1jjPGpZSxR4xbhQHyCMSGq ```
Cardano ADA **BEP20 Binance Smart Chain Network BSC** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ``` **ADA Cardano Network** ``` DdzFFzCqrht9Y1r4Yx7ouqG9yJNWeXFt69xavLdaeXdu4cQi2yXgNWagzh52o9k9YRh3ussHnBnDrg7v7W2hSXWXfBhbo2ooUKRFMieM ```
Sandbox SAND Decentraland MANA **ERC20 Ethereum Network** ``` 0xb78c4cf63274bb22f83481986157d234105ac17e ```
Algorand ALGO **ALGO Algorand Network** ``` WM54DHVZQIQDVTHMPOH6FEZ4U2AU3OBPGAFTHSCYWMFE7ETKCUUOYAW24Q ```
Binance [https://pay.binance.com/en/checkout/e92e536210fd4f62b426ea7ee65b49c3](https://pay.binance.com/en/checkout/e92e536210fd4f62b426ea7ee65b49c3 "Send via Binance Pay")
juancarlospaco commented 1 year ago

Proxy does not work with the download function, it can work with the fetch function directly.

juancarlospaco commented 1 year ago

You have to read about how HTTP works, because you have to make the request to the proxy address instead of the web server of the web page, then on the proxy header you put the address of the web server of the page, so proxy fetch it for you and serve it and cache it, it works basically but you have to know HTTP, I do not have time to make examples sadly.

Random-Code-Guy commented 1 year ago

You have to read about how HTTP works, because you have to make the request to the proxy address instead of the web server of the web page, then on the proxy header you put the address of the web server of the page, so proxy fetch it for you and serve it and cache it, it works basically but you have to know HTTP, I do not have time to make examples sadly.

i managed todo it just using

requests.get(url, proxyurl=proxy)[0]

works ok so far and allows me to use the same code for downloads as well as normal requests simply by sending an useproxy bool option