Git Product home page Git Product logo

proxy_requests's Introduction

Python Proxy Requests | make an http GET/POST with a proxy scraped from https://www.sslproxies.org/

pypi.org: https://pypi.org/project/proxy-requests/

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 get, post, post_with_headers, and post_file methods that will override the Parent methods.

example GET:
  r = ProxyRequests("https://api.ipify.org")
  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

Example 1:

example1


Example 2:

example2

proxy_requests's People

Contributors

rootviii avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.