1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.
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.
System Requirements: Python 3 and the requests module.
Youtube Demo: https://youtu.be/isxJeqo_sBA
Runs on Linux and Windows (and Mac probably)-It may take a moment to run depending on current proxy.
Either copy the code and put where you want it, or download via pip:
pip3 install proxy-requests
from proxy_requests.proxy_requests import ProxyRequests
or if you need the Basic Auth subclass as well:
from proxy_requests.proxy_requests import ProxyRequests, ProxyRequestsBasicAuth
If the above import statement is used, method calls will be identical to the ones shown below. Pass a fully qualified URL when initializing an instance.
The ProxyRequestBasicAuth subclass has the methods get(), get_with_headers(), post(), post_with_headers(), post_file(), and post_file_with_headers() that will override the Parent methods.
example GET:
r = ProxyRequests("https://api.ipify.org")
r.get()
example GET with headers:
h = {"User-Agent": "NCSA Mosaic/3.0 (Windows 95)"}
r = ProxyRequests("url here")
r.set_headers(h)
r.get_with_headers()
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 POST FILE with headers
h = {"User-Agent": "NCSA Mosaic/3.0 (Windows 95)"}
r = ProxyRequests("url here")
r.set_headers(h)
r.set_file({'file': open('test.txt', 'rb')})
r.post_file_with_headers()
example GET with Basic Authentication:
r = ProxyRequestsBasicAuth("url here", "username", "password")
r.get()
example GET with headers & Basic Authentication:
h = {"User-Agent": "NCSA Mosaic/3.0 (Windows 95)"}
r = ProxyRequestsBasicAuth("url here", "username", "password")
r.set_headers(h)
r.get_with_headers()
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()
example POST FILE with headers & Basic Authentication:
h = {"User-Agent": "NCSA Mosaic/3.0 (Windows 95)"}
r = ProxyRequestsBasicAuth("url here", "username", "password")
r.set_headers(h)
r.set_file({'file': open('test.txt', 'rb')})
r.post_file_with_headers()
Response Methods:
Returns a string:
print(r)
Or if you want the raw content as bytes:
r.get_raw()
Get the response headers:
print(r.get_headers())
Get the status code:
print(r.get_status_code())
Get the proxy that was used to make the request:
print(r.get_proxy_used())
To write response a to a file (including an image):
r.response_to_file()
Load your response to JSON:
import json
r = ProxyRequests(url)
r.get()
json.loads(r.get_raw().decode())
This was developed on Ubuntu 16.04.4 LTS.
Author: James Loye Colley 04AUG2018
Metadata
Release files for proxy-requests 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| proxy_requests-0.2.0.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| proxy_requests-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / proxy_requests-0.2.0.tar.gz
| Download URL | proxy_requests-0.2.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a35d74d8560abbe9d1533c8f34a1b6955169490fbcb0ad79014bb2348f31ee0a
|
|
BLAKE2b-256 checksum How to use checksums |
c2623e3afabc8c1a3fc14c16131fcc283d177a4e28a21a01f2a00e0d84a48824
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.20.0 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.5.2
|
Release files / proxy_requests-0.2.0-py3-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | proxy_requests-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d4a698444a61123da40d64ada2945116e77c610b63b993aab55189491170c6f
|
|
BLAKE2b-256 checksum How to use checksums |
0af1bedc5ba6d4faebf8acba161b82de46058ee4a93d84a6ffa1775645defdd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.9
|