semvec/pypi-packages huggingface dataset:
scrapy-zenscrape 0.0.3
Scrapy middleware for Zenscrape
License: MIT
Requires Python: >=3.5

## Scrapy Zenscrape Middleware

### Acknowledgements

Thanks to [arimbr](https://github.com/arimbr) and [ScrapingBee](https://github.com/ScrapingBee/scrapy-scrapingbee), this is adaptation of their work.

### Installation

`pip install scrapy-zenscrape`

### Configuration

Add your `ZENSCRAPE_API_KEY` and the `ZenscrapeMiddleware` to your project settings.py. Don't forget to set `CONCURRENT_REQUESTS` according to your [Zenscrape plan](https://zenscrape.com/#pricingSection).

```python
ZENSCRAPE_API_KEY = 'REPLACE-WITH-YOUR-API-KEY'

DOWNLOADER_MIDDLEWARES = {
    'scrapy_zenscrape.ZenscrapeMiddleware': 700,
}

CONCURRENT_REQUESTS = 1
```

### Usage

Inherit your spiders from `ZenscrapeSpider` and yield a `ZenscrapeRequest`.

Below you can see an example from the spider in [httpbin.py](examples/httpbin/httpbin/spiders/httpbin.py).

```python
from scrapy import Spider
from scrapy_zenscrape import ZenscrapeSpider, ZenscrapeRequest

class HttpbinSpider(Spider):
    name = 'httpbin'
    start_urls = [
        'https://httpbin.org',
    ]

    def start_requests(self):
        for url in self.start_urls:
            yield ZenscrapeRequest(url, params={
                # 'render': False,
                # 'block_ads': True,
                # 'block_resources': False,
                # 'premium': True,
                # 'location': 'fr',
                # 'wait_for': 5,
                # 'wait_for_css': '#swagger-ui',
            },
            headers={
                # 'Accept-Language': 'En-US',
            },
            cookies={
                # 'name_1': 'value_1',
            })

    def parse(self, response):
        ...
```

You can pass [Zenscrape parameters](https://app.zenscrape.com/documentation) in the params argument of a ZenscrapeRequest. Headers and cookies are passed like a normal Scrapy Request. ZenscrapeRequests formats all parameters, headers and cookies to the format expected by the API.

### Examples

Add your API key to [settings.py](examples/httpbin/httpbin/settings.py).

To run the examples you need to clone this repository. In your terminal, go to `examples/httpbin/httpbin` and run the example spider with:

```bash
scrapy crawl httpbin
```
mpcspy 0.0.5
My Personal Configuration System for Python
License: MIT
Requires Python: >=3.6

My Personal Configuration System for Python MPCSPY
===================================

I like to use Python as a configuration file. I have added some security
features using AST module to prevent injecting malicious code to config
files.

## Requirements
- Python >= 3.6 (fstrings)

## Install

### PyPI

``` bash
pip3 install mpcspy
```

### Source

``` bash
git clone https://github.com/goktug97/mpcspy
cd mpcspy
python3 setup.py install
```

### Example

1. 

- Config File
``` python
#!/usr/bin/env python3

import dataclasses
import numpy as np

@dataclasses.dataclass
class Robot(object):
    width: float = 1.2 # [m]
    height: float = 0.5 # [m]
    max_angular_velocity: float = np.radians(40.0) # [rad/s]
```

- Reading Config
``` python
import mpcspy
config = mpcspy.read_config(config_file = 'config',
        allowed_modules={'numpy': ['radians'],
            'dataclasses': ['dataclass']},
        allowed_functions=[],
        verbose=True)
print(config.Robot.width)
print(config.Robot.height)
print(config.Robot.max_angular_velocity)
```

2. 

- Config File
``` python
#!/usr/bin/env python3

from os import path

dataset_path = path.join('./data/')
```

- Reading Config
``` python
import mpcspy
config = mpcspy.read_config(config_file = 'config',
        allowed_modules={'os': ['path'],
            'path': ['join']},
        allowed_functions=[],
        verbose=True)
```