Giter Site home page Giter Site logo

urlrequests's Introduction

URLRequests

You might have seen this version of code in many repos, but this is my version of the same with a few minor tweaks. The following documentation specifies the language and libraries used to build this project.

Language : Python

Libraries Used : optparse, time, random, requests

Required Packages

Before you use this program, you would need to install the required libraries as mentioned above and can be done using the following command:

pip3 install -r requirements.txt

Usage :

python3 urlrequests.py --link https://bit.ly/ProfileGitHub --time 25 

Documentation

This a project which enables you to send requests to a certain URL either at a fixed interval of time or random interval of time by using the requests library. Depending on the type of URL you must specify the contents of the headers, for instance URLs from URLShorteners such as bit.ly require header contents as follows:

'Content-Type': 'text/html',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36' 

but for other URLs, you can get away without specifying them.

It also utilizes the other libraries such as optparse to parse the options provided during command execution. The other libraries include the time library to provide time intervals between each requests, it's a necessary evil required to prevent abuse the provided URLs. Last, but not the least it utilizes random library to generate a time interval between 5-30 seconds incase the time interval is not specified.

Just a word of caution, if the time inteval is specified manually be sure to give a minimum of 5 seconds of time interval between each request. You can also change the User-Agent based on your liking. The help menu can be used as follows:

python3 urlrequests.py --help 

Output:
Usage: shortener.py [options]

Options:
  -h, --help             show this help message and exit
  -l LINK, --link=LINK  [Required] Used to specify a link for sending requests
  -t TIME, --time=TIME  [Optional] Used to specify the time interval between
                        each request
If time is not specified, a random time interval
between 5 to 30 seconds would be selected between each request.
Example: python3 urlrequests.py --link https://bit.ly/ProfileGitHub --time 20

Hope you found this project useful, if you have any queries feel free to raise an issue or contact me using the above-mentioned means!

Future Imporvements:

  • To be able to provide custom User-Agent via the execution command.
  • Add an option for specifying a time interval for the random time-interval option.
  • Further House-Keeping & Beautification of Code.

urlrequests's People

Contributors

davezaxh 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.