A wrapper for the Python 3 requests module
Project description
Python Proxy Requests
make an http GET/POST with a proxy scraped from https://www.sslproxies.org/
The ProxyRequests class first scrapes proxies from the web
Then it recursively attempts to make a request if the initial request with a proxy is unsuccessful
Requirements: Python 3 and the requests module
Pass it a fully qualified URL when initializing an instance
The ProxyRequestBasicAuth subclass has get, post, post_with_headers, and post_file, and string methods that will override the Parent methods
pip3 install proxy-requests
from proxy_requests.proxy_requests import ProxyRequests, ProxyRequestsBasicAuth
example GET:
r = ProxyRequests("https://postman-echo.com/get?foo1=bar1&foo2=bar2")
r.get()
example POST:
r = ProxyRequests("url here")
r.post({"key1": "value1", "key2": "value2"})
example POST with headers:
r = ProxyRequests("url here")
r.set_headers({"name": "rootVIII", "secret_message": "7Yufs9KIfj33d"})
r.post_with_headers({"key1": "value1", "key2": "value2"})
example POST FILE:
r = ProxyRequests("url here")
r.set_file({'file': open('test.txt', 'rb')})
r.post_file()
example GET with Basic Authentication:
r = ProxyRequestsBasicAuth("url here", "username", "password")
r.get()
example post with Basic Authentication
r = ProxyRequestsBasicAuth("url here", "username", "password")
r.post({"key1": "value1", "key2": "value2"})
example post with headers & Basic Authentication
r = ProxyRequestsBasicAuth("url here", "username", "password")
r.set_headers({"header_key": "header_value"})
r.post_with_headers({"key1": "value1", "key2": "value2"})
example POST FILE with Basic Authentication:
r = ProxyRequestsBasicAuth("url here", "username", "password")
r.set_file({'file': open('test.txt', 'rb')})
r.post_file()
print(r)
print(r.get_headers())
print(r.get_status_code())
print(r.to_json())
print(r.get_proxy_used())
The to_json() method is not intended to be used for a string of HTML
This was developed on Ubuntu 16.04.4 LTS.
Author: James Loye Colley 04AUG2018
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for proxy_requests-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06c7967675d84bd016f5b80083e0c8ad7bd3f85f2ea1f02c2800a3274b3315e0 |
|
MD5 | 9b2762e5f56d3986bffcc147d460e015 |
|
BLAKE2b-256 | 8a20b4655538e8335493a3f83d85f95d1dfa3f82f10b4688f36598e5f9aae048 |