Fastest python library for making asynchronous group requests.

Overview

FGrequests: Fastest Asynchronous Group Requests

PyPI version fury.io PyPI pyversions License Donate

Installation

Install using pip:

pip install fgrequests

Documentation

Pretty easy to use.

import fgrequests

urls = [
    'https://google.com',
    'https://facebook.com',
    'https://twitter.com',
    'https://linkedin.com',
    'https://fakedomain.com'
]

Now lets make requests at the same time to the list of URLs (urls)

>>> response = fgreuests.build(urls)
>>> print(response)
[<Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>, None]

By default fgrequests.build() returns a list of responses. If there have any invalid URL, the response will be None.

Method

By default this build() using GET method. There is a parameter which accepts methods named method. You can change this according to your need. method will accept these: GET, POST, PUT, DELETE, PATCH.

Lets send POST request in all of the urls

>>> response = fgreuests.build(urls, method='POST')
>>> print(response)
[<Response [405]>, <Response [200]>, <Response [200]>, <Response [200]>, None]

Headers

If you want to pass any headers you can simply pass your headers object (which may contain the authentication information) if you do like this:

>>> headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
    "Authorization": "Bearer XXXXXXXXXXXXXXXTOKEN"
}
>>> response = fgreuests.build(urls, headers=headers)

Params/Payload

If you want to pass additional information while making requests, just pass your params / payload by following way:

>>> data = {
    'username': 'farid'
    'password': 'password123'
}
>>> response = fgreuests.build(urls, data=data)

Proxies

If you need to use a proxy, you can configure individual requests with the proxies argument to any request method:

>>> proxies = {
    'http': 'http://10.10.1.10:3128',
    'https': 'http://10.10.1.10:1080',
}
>>> response = fgreuests.build(urls, proxies=proxies)

To use HTTP Basic Auth with your proxy, use the http://user:[email protected]/ syntax:

>>> proxies = {'http': 'http://user:[email protected]:3128/'}

To give a proxy for a specific scheme and host, use the scheme://hostname form for the key. This will match for any request to the given scheme and exact hostname.

>>> proxies = {'http://10.20.1.128': 'http://10.10.1.10:5323'}

SSL Cert Verification

Requests verifies SSL certificates for HTTPS requests, just like a web browser. By default, SSL verification is enabled, and Requests will throw a SSLError if it’s unable to verify the certificate. Requests can also ignore verifying the SSL certificate if you set verify to False:

>>> response = fgrequests.build(urls, verify=False)

For more info: SSL Cert Verification

Worker

It has another parameter worker. By default the value of worker is 40. If you increase this it will work more faster. But there is a problem if you increase this too much, this will make a lot of pressure in your CPU cores which may freeze your system. If you reduce the value of worker you this will take more time to return responses. You can change the value of worker like this:

>>> response = fgreuests.build(urls, worker=70)

POST a Multipart-Encoded File

You can simply to upload Multipart-encoded files by using files parameter:

>>> urls = ['https://httpbin.org/post']
>>> files = {'file': open('report.xls', 'rb')}

>>> response = fgrequests.build(urls, method='POST', files=files)
>>> response[0].text
{
  ...
  "files": {
    "file": "<censored...binary...data>"
  },
  ...
}

You can set the filename, content_type and headers explicitly:

>>> urls = ['https://httpbin.org/post']
>>> files = {'file': ('report.xls', open('report.xls', 'rb'), 'application/vnd.ms-excel', {'Expires': '0'})}

>>> response = fgrequests.build(urls, method='POST', files=files)
>>> response[0].text
{
  ...
  "files": {
    "file": "<censored...binary...data>"
  },
  ...
}

If you want, you can send strings to be received as files:

>>> urls = ['https://httpbin.org/post']
>>> files = {'file': ('report.csv', 'some,data,to,send\nanother,row,to,send\n')}

>>> response = fgrequests.build(urls, method='POST', files=files)
>>> response[0].text
{
  ...
  "files": {
    "file": "some,data,to,send\\nanother,row,to,send\\n"
  },
  ...
}

Timeout

You can set timeout for the group request by using another parameter timeout. By default the value of timeout is 3 which is in seconds. You can change the value of timeout like this:

>>> response = fgreuests.build(urls, timeout=5)

Max Retries

You can put the count of maximum retries (to handle worst scenario) by using max_retries parameter. By default the value of max_retries is 1. You can change the value of max_retries like this:

>>> response = fgreuests.build(urls, max_retries=3)

Allow Redirects

You can disable redirection handling with the allow_redirects parameter. It only accepts Boolean, either True or False. By default it is True. You can change this by following way:

>>> response = fgreuests.build(urls, allow_redirects=False)

Execution Time

There have another parameter named show_execution_time. It returns the execution time (in sec). It accepts Boolean, either True or False. By default it is False. If you change this to True then fgrequests.build() will return an object. Lets check the output by making show_execution_time to True:

>>> response = fgrequests.build(urls, show_execution_time=True)
>>> print(response)
{
    'response_list': [<Response [200]>, <Response [200]>, <Response [200]>, <Response [200]>, None],
    'execution_time': 1.677
}

Support

You may report bugs, ask for help, and discuss various other issues on the bug tracker.

Donation

If this project help you reduce time to develop, you can give me a cup of coffee 🙂

paypal

You might also like...
Randomly distribute members by groups making sure that every sector is represented

Generate Groups Randomly distribute members by groups making sure that every sector is represented The Scenario Imagine that you have a large group of

New multi tool im making adding features currently

Emera Multi Tool New multi tool im making adding features currently Current List of Planned Features - Linkvertise Bypasser - Discord Auto Bump - Gith

A Lite Package focuses on making overwrite and mending functions easier and more flexible.

Overwrite Make Overwrite More flexible In Python A Lite Package focuses on making overwrite and mending functions easier and more flexible. Certain Me

an opensourced roblox group finder writen in python 100% free and virus-free

Roblox-Group-Finder an opensourced roblox group finder writen in python 100% free and virus-free note : if you don't want install python or just use w

TeamFleming is a multicultural group of 20 young bioinformatics enthusiasts participating in the 2021 HackBio Virtual Summer Internship
TeamFleming is a multicultural group of 20 young bioinformatics enthusiasts participating in the 2021 HackBio Virtual Summer Internship

💻 Welcome to Team Fleming's Repo! #TeamFleming is a multicultural group of 20 young bioinformatics enthusiasts participating in the 2021 HackBio Virt

Team Curie is a group of people working together to achieve a common aim
Team Curie is a group of people working together to achieve a common aim

Team Curie is a group of people working together to achieve a common aim. We are enthusiasts!.... We are setting the pace!.... We offer encouragement and motivation....And we believe TeamWork makes the DreamWork.

Group P-11's submission for the University of Waterloo's 2021 Engineering Competition (Programming section).
Group P-11's submission for the University of Waterloo's 2021 Engineering Competition (Programming section).

P-11-WEC2021 Group P-11's submission for the University of Waterloo's 2021 Engineering Competition (Programming section). Part I Compute typing time f

A discord group chat creator just made it because i saw people selling this stuff for like up to 40 bucks

gccreator some discord group chat tools just made it because i saw people selling this stuff for like up to 40 bucks (im currently working on a faster

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat
Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat 📊 Stats 🧪 Get SESSION_NAME from below:

Releases(0.1.0)
Owner
Farid Chowdhury
Python | Django
Farid Chowdhury
A module that can manage you're gtps

Growtopia Private Server Controler Module For Controle Your GTPS | Build in Python3 Creator Information

iFanpS 6 Jan 14, 2022
Web app for keeping track of buildings in danger of collapsing in the event of an earthquake

Bulina Roșie 🇷🇴 Un cutremur în București nu este o situație ipotetică. Este o certitudine că acest lucru se va întâmpla. În acest context, la mai bi

Code for Romania 27 Nov 29, 2022
chiarose(XCR) based on chia(XCH) source code fork, open source public chain

chia-rosechain 一个无耻的小活动 | A shameless little event 如果您喜欢这个项目,请点击star 将赠送您520朵玫瑰,可以去 facebook 留下您的(xcr)地址,和github用户名。 If you like this project, please

ddou123 376 Dec 14, 2022
Cairo-integer-types - A library for bitwise integer types (e.g. int64 or uint32) in Cairo, with a test suite

The Cairo bitwise integer library (cairo-bitwise-int v0.1.1) The Cairo smart tes

27 Sep 23, 2022
Snakemake worflow to process and filter long read data from Oxford Nanopore Technologies.

Nanopore-Workflow Snakemake workflow to process and filter long read data from Oxford Nanopore Technologies. It is designed to compare whole human gen

5 May 13, 2022
Minutaria is a basic educational Python timer used to learn python and software testing libraries.

minutaria minutaria is a basic educational Python timer. The project is educational, it aims to teach myself programming, python programming, python's

1 Jul 16, 2021
Python wrapper to different clients to determine how a particular term is used.

Python wrapper to different clients to determine how a particular term is used.

Chris Mungall 3 Oct 24, 2022
Brython (Browser Python) is an implementation of Python 3 running in the browser

brython Brython (Browser Python) is an implementation of Python 3 running in the browser, with an interface to the DOM elements and events. Here is a

5.9k Jan 02, 2023
Repositório de código de curso de Djavue ministrado na Python Brasil 2021

djavue-python-brasil Repositório de código de curso de Djavue ministrado na Python Brasil 2021 Completamente baseado no curso Djavue. A diferença está

Buser 15 Dec 26, 2022
Convert ldapdomaindump to Bloodhound

ldd2bh Usage usage: ldd2bh.py [-h] [-i INPUT_FOLDER] [-o OUTPUT_FOLDER] [-a] [-u] [-c] [-g] [-d] Convert ldapdomaindump to Bloodhoun

64 Oct 30, 2022
A basic DIY-project made using Python and MySQL

Banking-Using-Python-MySQL This is a basic DIY-project made using Python and MySQL. Pre-Requisite needed:-- MySQL command Line:- creating a database

ABHISHEK 0 Jul 03, 2022
TallerStereoVision Convencion Python Chile 2021

TallerStereoVision Convencion Python Chile 2021 Taller Stereo Vision & Python PyCon.cl 2021 Instalación Se recomienta utilizar Virtual Environment pyt

2 Oct 20, 2022
A collection of python exercises to help your learning path!

How to use Step 1: run this command git clone https://github.com/TechPenguineer/Python-Exercises.git Step 2: Run this command cd Python-Exercises You

Tech Penguin 5 Aug 05, 2021
A basic ticketing software.

Ticketer A basic ticketing software. Screenshots Program Launched Issuing Ticket Show your Ticket Entry Done Program Exited Code Features to implement

Samyak Jain 2 Feb 10, 2022
A webapp that timestamps key moments in a football clip

A look into what we're building Demo.mp4 Prerequisites Python 3 Node v16+ Steps to run Create a virtual environment. Activate the virtual environment.

Pranav 1 Dec 10, 2021
Predict if a fuse is usable on an appliance depending on the fuse rating

fuse-feasibility-analysis Predict if a fuse is usable on an appliance depending on the fuse rating , Power rating and resistance in the appliance

Sebastian Muchui 4 Jul 21, 2022
Modelling the 30 salamander problem from `Pure Mathematics` by Martin Liebeck

Salamanders on an island The Problem From A Concise Introduction to Pure Mathematics By Martin Liebeck Critic Ivor Smallbrain is watching the horror m

Faisal Jina 1 Jul 10, 2022
Projects and assets from Wireframe #56

Wireframe56 Projects and assets from Wireframe #56 Make a Boulder Dash level editor in Python, pages 50-57, by Mark Vanstone. Code an homage to Bubble

Wireframe magazine 10 Sep 07, 2022
Anki cards generator for Leetcode

Leetcode Anki card generator Summary By running this script you'll be able to generate Anki cards with all the leetcode problems. I personally use it

Pavel Safronov 150 Dec 25, 2022
Fortnite StW Claimer for Daily Rewards, Research Points and free Llamas.

Fortnite Save the World Daily Reward, Research Points & free Llama Claimer This program allows you to claim Save the World Daily Reward, Research Poin

PRO100KatYT 27 Dec 22, 2022