All Projects → pgaref → Http_request_randomizer

pgaref / Http_request_randomizer

Licence: mit
Proxying Python Requests

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Http request randomizer

Proxybroker
Proxy [Finder | Checker | Server]. HTTP(S) & SOCKS 🎭
Stars: ✭ 2,767 (+2415.45%)
Mutual labels:  proxy, proxies, anonymity
Spoon
🥄 A package for building specific Proxy Pool for different Sites.
Stars: ✭ 173 (+57.27%)
Mutual labels:  proxy, proxies
Baiducrawler
Sample of using proxies to crawl baidu search results.
Stars: ✭ 116 (+5.45%)
Mutual labels:  proxy, proxies
ProxyGrab
Asynchronous Library made using Python and aiohttp to get proxies from multiple services!
Stars: ✭ 17 (-84.55%)
Mutual labels:  proxies, requests
Fetch Some Proxies
Simple Python script for fetching "some" (usable) proxies
Stars: ✭ 470 (+327.27%)
Mutual labels:  proxy, anonymity
Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+2539.09%)
Mutual labels:  proxy, requests
Smartproxy
HTTP(S) Rotating Residential proxies - Code examples & General information
Stars: ✭ 205 (+86.36%)
Mutual labels:  proxy, proxies
Udpx
A Fast UDP Proxy written in Golang
Stars: ✭ 56 (-49.09%)
Mutual labels:  proxy, proxies
Proxy requests
a class that uses scraped proxies to make http GET/POST requests (Python requests)
Stars: ✭ 357 (+224.55%)
Mutual labels:  proxy, requests
Proxy List
Get PROXY List that gets updated everyday
Stars: ✭ 347 (+215.45%)
Mutual labels:  proxy, anonymity
Proxy Scraper
Proxy-Scraper is simple Perl script for scraping proxies from multiple websites.
Stars: ✭ 24 (-78.18%)
Mutual labels:  proxy, proxies
Tor Android
Tor binary and library for Android
Stars: ✭ 90 (-18.18%)
Mutual labels:  proxy, anonymity
Edge
A set of useful libraries for Edge Apps. Run locally, write tests, and integrate it into your deployment process. Move fast and maybe don't break things? Because, gosh darnit, you're an adult.
Stars: ✭ 105 (-4.55%)
Mutual labels:  proxies
V2ray Core
A platform for building proxies to bypass network restrictions.
Stars: ✭ 38,782 (+35156.36%)
Mutual labels:  proxy
Freeproxy
免费、高速的 V2Ray 代理和订阅。
Stars: ✭ 104 (-5.45%)
Mutual labels:  proxy
Forward Proxy
150 LOC Ruby forward proxy using only standard libraries.
Stars: ✭ 105 (-4.55%)
Mutual labels:  proxy
Pysocket
PySocket ,一个通过猴子补丁(monkey patch)动态修改 socket 的项目。在不修改源码的情况下给 socket 增加一些诸如限制客户端数量、前置代理之类的功能。让我们将 Monkey Patch 进行到底吧!
Stars: ✭ 108 (-1.82%)
Mutual labels:  proxy
Hotel
🏩 A simple process manager for developers. Start apps from your browser and access them using local domains
Stars: ✭ 9,736 (+8750.91%)
Mutual labels:  proxy
Earlyap
Proxy specifically available for AP scores to enable simple early access to your scores without any storing of your College Board account details or dealing with untrustable proxies.
Stars: ✭ 104 (-5.45%)
Mutual labels:  proxy
Process Proxifier
Using FiddlerCore to add proxy settings to the Windows applications
Stars: ✭ 104 (-5.45%)
Mutual labels:  proxy

HTTP Request Randomizer Build Status codecov Requirements Status PyPI version

Vietnamese version

A convenient way to implement HTTP requests is using Pythons' requests library. One of requests’ most popular features is simple proxying support. HTTP as a protocol has very well-defined semantics for dealing with proxies, and this contributed to the widespread deployment of HTTP proxies

Proxying is very useful when conducting intensive web crawling/scrapping or when you just want to hide your identity (anonymization).

In this project I am using public proxies to randomise http requests over a number of IP addresses and using a variety of known user agent headers these requests look to have been produced by different applications and operating systems.

Proxies

Proxies provide a way to use server P (the middleman) to contact server A and then route the response back to you. In more nefarious circles, it's a prime way to make your presence unknown and pose as many clients to a website instead of just one client. Often times websites will block IPs that make too many requests, and proxies is a way to get around this. But even for simulating an attack, you should know how it's done.

User Agent

Surprisingly, the only thing that tells a server the application triggered the request (like browser type or from a script) is a header called a "user agent" which is included in the HTTP request.

The source code

The project code in this repository is crawling five different public proxy websites:

After collecting the proxy data and filtering the slowest ones it is randomly selecting one of them to query the target url. The request timeout is configured at 30 seconds and if the proxy fails to return a response it is deleted from the application proxy list. I have to mention that for each request a different agent header is used. The different headers are stored in the /data/user_agents.txt file which contains around 900 different agents.

Installation

If you wish to use this module as a CLI tool, install it globally via pip:

  pip install http-request-randomizer

Otherwise, you can clone the repository and use setup tools:

python setup.py install

Dev testing

Clone repo, install requirements, develop and run tests:

pip install -r requirements.txt
tox -e pyDevVerbose

How to use

Command-line interface

Assuming that you have http-request-randomizer installed, you can use the commands below:

show help message:

proxyList   -h, --help

specify proxy provider(s) (required):

  -s {proxyforeu,rebro,samair,freeproxy,all} 

Specify output stream (default: sys.stdout), could also be a file:

  -o, --outfile

specify provider timeout threshold in seconds:

  -t, --timeout

specify proxy bandwidth threshold in KBs:

  -bw, --bandwidth

show program's version number:

  -v, --version

API

To use http-request-randomizer as a library, include it in your requirements.txt file. Then you can simply generate a proxied request using a method call:

import logging
import time
from http_request_randomizer.requests.proxy.requestProxy import RequestProxy

if __name__ == '__main__':

    start = time.time()
    req_proxy = RequestProxy(log_level=logging.ERROR)
    print("Initialization took: {0} sec".format((time.time() - start)))
    print("Size: {0}".format(len(req_proxy.get_proxy_list())))
    print("ALL = {0} ".format(list(map(lambda x: x.get_address(), req_proxy.get_proxy_list()))))

    test_url = 'http://ipv4.icanhazip.com'

    while True:
        start = time.time()
        request = req_proxy.generate_proxied_request(test_url)
        print("Proxied Request Took: {0} sec => Status: {1}".format((time.time() - start), request.__str__()))
        if request is not None:
            print("\t Response: ip={0}".format(u''.join(request.text).encode('utf-8')))
        print("Proxy List Size: {0}".format(len(req_proxy.get_proxy_list())))

        print("-> Going to sleep..")
        time.sleep(10)

Changing log levels

The RequestProxy constructor accepts an optional parameter of log_level that can be used to change the level of logging. By default, this is equal to 0, or NOTSET. The python logging levels are documented here. You can either use integers or their equivalent constant in the logging module. (e.g. logging.DEBUG, logging.ERROR, etc)

Documentation

http-request-randomizer documentation

Contributing

Many thanks to the open-source community for contributing to this project!

Faced an issue?

Open an issue here, and be as detailed as possible :)

Feels like a feature is missing?

Feel free to open a ticket! PRs are always welcome!

License

This project is licensed under the terms of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].