Skip to main content

this is a requester for requests.

Project description

DataClient

Introduction

this is a request tool which packaging method server

Usage

from stormer import Requester

# init Requester instance
requester = Requester(
    "https://www.baidu.com", 
    redis_url="redis://127.0.0.1:6379/0", 
    # redis_nodes="127.0.0.1:7000,127.0.0.1:7001,127.0.0.1:7002", 
    # redis_password="",
    timeout=30, # in seconds,global cache timeout
    # headers={"Content-Type": "text/html;charset=utf8"},
    encoding='utf8'
)

# open debug
requester.set_debugging()

# register request function
requester.register(
    action="get", 
    func="bd_index", 
    uri="/", 
    timeout=5  # in second, this requester cache timeout
)

# execute function
rlt = requester.bd_index()
r_byte = rlt.bytes
print(rlt.data)
print(rlt.resp)

Project details


Download files

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

Source Distribution

stormer-0.1.2.tar.gz (6.9 kB view hashes)

Uploaded source

Built Distribution

stormer-0.1.2-py3-none-any.whl (9.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page