Skip to main content

Basic async requester

Project description

Project description

Asyncrequester is a library that makes it easy to make async requests with grequests library.

Install

pip install asyncrequester

Quick start

from asyncrequester import get_async_requests,get_single_request

headers = {
'authority': 'www.google.com',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'sec-fetch-site': 'none',
'sec-fetch-mode': 'navigate',
'sec-fetch-dest': 'document',
'accept-language': 'en'
}

urls = ["https://www.google.com"]*100 

responses = get_async_requests(urls,20,0.5,headers)
# it will make 20 requests every 0.5 seconds and return all responses
# 'headers' is optional

response = get_single_request(urls[0])
# it makes simple get request

Output

Total web page count: 100
0 Waiting
20 Waiting
40 Waiting
60 Waiting
80 Waiting
100 Waiting
Succes: 100 , Fail: 0
It took 7.0120155811309814 seconds to retrieve 100 webpages.

Parameters

  • urls: url list
  • max_connections: max connections at once
  • time_delay: delay for every request
  • headers: headers (Optinal)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

asyncrequester-0.1.3-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file asyncrequester-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: asyncrequester-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.7.9

File hashes

Hashes for asyncrequester-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7e8dd1b9121584f4c4190cfed3a03222752e0477b5c186e90603ce29d8ae5087
MD5 06d3ce95db765fec139c41c7d97349f9
BLAKE2b-256 3e05c19a753829d6dddc709f7237258249a0543869869c05af4a1c3d7c328a0a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page