Comments (8)
Mine is v0.7.1 too. I tried hard, but could not make it work. Normal proxies work fine, but when I try authentication, it always fails.
from hrequests.
to use proxy in sessions you can do like this:
session = hrequests.Session()
session.proxy = 'http://username:password@host:port'
from hrequests.
This library supports normal http proxies (example: http://proxy.example.com:8080).
But I couldn't get it to work with proxies that require username password authentication (example: http://username:[email protected]:8080).
I'd appreciate if you could me know whether and how this could be achieved.
from hrequests.
@cosmicsplendor hey, are able to find any workaround with this lib?
from hrequests.
Related to bogdanfinn/tls-client#66.
from hrequests.
@cosmicsplendor hey, are able to find any workaround with this lib?
I haven't been able to get this to work yet. Will update here if I find a workaround.
from hrequests.
this works, but you have to rely on requests library to create session:
import requests
import hrequests
proxies = {
'http': 'http://USERNAME:[email protected]',
'https': 'http://USERNAME:[email protected]'
}
session = requests.Session()
session.proxies.update(proxies)
response = hrequests.get('http://httpbin.org/ip', session=session)
print(response.text)
from hrequests.
@cosmicsplendor What hrequests
version do you use? It worked for me with v0.7.1.
>>> import hrequests
>>> response = hrequests.get('http://httpbin.org/ip', debug=True, verify=False, proxies=proxies)
raw request bytes sent over wire: 344 (0 kb)
headers on request:
map[Accept:[*/*] Accept-Encoding:[gzip, deflate, br] Accept-Language:[en-US;q=0.5,en;q=0.3] Connection:[keep-alive] Header-Order::[] Host:[httpbin.org] Referer:[https://google.com] Upgrade-Insecure-Requests:[1] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.0 Safari/537.36]]
cookies on request:
[]
headers on response:
map[Access-Control-Allow-Credentials:[true] Access-Control-Allow-Origin:[*] Connection:[keep-alive] Content-Length:[31] Content-Type:[application/json] Date:[Wed, 10 Jan 2024 10:41:27 GMT] Server:[gunicorn/19.9.0]]
cookies on response:
[]
requested http://httpbin.org/ip : status 200
response body payload: {
"origin": "...omitted..."
}
raw response bytes received over wire: 260 (0 kb)
>>> hrequests.__version__
'0.7.1'
from hrequests.
Related Issues (20)
- How to wait cloudflare checking using hrequests?
- Browser version selection not showing in request Header HOT 2
- Dockerfile with hrequest HOT 1
- Pyinstaller support HOT 1
- Unsupported chrome version error HOT 2
- Overriding encoding HOT 8
- Lambda Execution Issues
- TypeError: string indices must be integers HOT 1
- No Binaries for M1 Macs HOT 2
- How i can use Browser Automation? HOT 2
- Cookies not properly set in session HOT 3
- hrequests[all] doesn't support Python 3.12 HOT 1
- Content is not fully loaded HOT 1
- Resp.render is not applying proxy HOT 1
- How use proxy HOT 1
- How to create new fingerprint for each request
- Browser Session - Error
- How to deal with web page dialogs (alert, confirm etc.)?
- hrequests-cgo-2.1-windows-4.0-amd64.dll Error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hrequests.