A secure python library for fetching data with async, JS, and Tor support
Project description
PyGrab
PyGrab is a Python library for making HTTP requests. It is designed to be fully interoperable with the popular requests
package in Python. All functions in PyGrab that make HTTP requests return requests.Response
objects, making it easy to integrate into existing projects that use requests
.
References
Features
- Simple: PyGrab's API is designed to be straightforward and easy to use. If you're familiar with
requests
, you'll feel right at home. - Flexible: Whether you need to make a simple GET request, post data to a server, or download a file, PyGrab has you covered.
- Asynchronous Support: PyGrab includes functions for making asynchronous HTTP requests, allowing you to efficiently grab data from multiple URLs at once.
- JavaScript Support: PyGrab can render JavaScript-enabled websites, allowing you to grab data from dynamic web pages.
- Interface with Tor Network: PyGrab includes built-in support for routing requests through the tor network.
- Automated IP Rotation: PyGrab includes built-in support for rotating connections to the Tor Network.
Installation
You can install PyGrab using pip:
pip install pygrab
Usage
Here's a simple example of how to use PyGrab to make a GET request:
import pygrab
response = pygrab.get('http://example.com')
print(response.text)
In this example, response
is a requests.Response
object. You can use it just like you would in requests
.
Here's an example of how to use PyGrab to make asynchronous GET requests through the Tor Network:
import pygrab
pygrab.Tor.start_tor()
urls = ['http://example.com', 'http://example.org', 'http://example.net']
responses = pygrab.get_async(urls)
for response in responses.values():
print(response.text)
In this example, responses
is a dictionary of urls matched to their respective requests.Response
objects. Each response corresponds to the URL at the same index in the urls
list.
Contributing
Contributions are welcome. Please submit a pull request with any improvements.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pygrab-2.1.1.tar.gz
.
File metadata
- Download URL: pygrab-2.1.1.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec79ce7ae648779fdddcbdb406855454a205d0c2ddfde466bbe510cced66929 |
|
MD5 | 4c454efd10cff21db2ff8407a5c1d386 |
|
BLAKE2b-256 | 341ebfc91b5f0b9faaed0119df00540c2f433760721a38e9043c7ac846b24c98 |
File details
Details for the file pygrab-2.1.1-py3-none-any.whl
.
File metadata
- Download URL: pygrab-2.1.1-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b06da7d594810e592ec175f518c5d5c3f845c00672c24cd57333fda8c010494 |
|
MD5 | 12aa64c610e5a6a0f1b0eb1ad7430ab2 |
|
BLAKE2b-256 | bba33df254b625c3e16da6b710516fa482b06954f5e33fd6320499efa2afb380 |