semvec/pypi-packages huggingface dataset:
warsaw-data-api 0.5.3
Warsaw data python api
License: MIT
Requires Python: >=3.7,<4.0

# Pythonic way to use Warsaw data API

This package allow to fetch data from API provided by "UM Warszawa" - https://api.um.warszawa.pl/

## Current features

- Fetch ZTM buses and trams real-time location
- Fetch Schedule for bus stop for certain bus line

## Getting Started

## Installation

```
pip install warsaw-data-api
```

## Using ZTM module

### Get buses/trams locations:

We can fetch all location data for buses:

```python
import warsaw_data_api

ztm = warsaw_data_api.ztm(apikey='your_api_key') # you can get API KEY on the https://api.um.warszawa.pl/ after you register
buses = ztm.get_buses_location()

for bus in buses:
    print(bus)
```

We can do the same for trams, as a parameter we can set number of tram line

```python
import warsaw_data_api

ztm = warsaw_data_api.ztm(apikey='your_api_key')
trams = ztm.get_trams_location(line=17)

for tram in trams:
    print(tram)
```

### Get buses schedule:

We can fetch schedule by using bus stop id:

```python
import warsaw_data_api

ztm = warsaw_data_api.ztm(apikey='your_api_key')
schedule = ztm.get_bus_stop_schedule_by_id("7009", "01", "182")
print(schedule.rides)
```

or we can fetch it by using bus stop name:

```python
import warsaw_data_api

ztm = warsaw_data_api.ztm(apikey='your_api_key')
schedule = ztm.get_bus_stop_schedule_by_name("Marszałkowska", "01", "182")
print(schedule.rides)

```

if you would like to retrieve all buses for the bus stop you can use this:

```python
import warsaw_data_api

ztm = warsaw_data_api.ztm(apikey='your_api_key')
lines = ztm.get_lines_for_bus_stop_id("7009", "01")
print(lines)
```

You can also retrieve bus stop id by passing bus stop name:

```python
import warsaw_data_api

ztm = warsaw_data_api.ztm(apikey='your_api_key')
bus_stop_id = ztm.get_bus_stop_id_by_bus_stop_name("Marszałkowska")
print(bus_stop_id)
```

### Passing API Key

We can pass API Key in two different ways:

1. Pass API Key to factory function (`ztm()` in this case) as a parameter `ztm = warsaw_data_api.ztm(apikey='your_api_key')`
2. Create environment variable called `WARSAW_DATA_API_KEY`
gerapy-rabbitmq 0.1.1
Distribution Support for Scrapy & Gerapy using RabbitMQ
License: MIT
Requires Python: >=3.5.0


# Gerapy RabbitMQ

This is a package for supporting distribution in Scrapy using RabbitMQ, also this
package is a module in [Gerapy](https://github.com/Gerapy/Gerapy).

## Installation

You can install with this command:

```shell script
pip3 install gerapy-rabbitmq
```

## Usage

Required configuration:

```python
# Use RabbitMQ for queue
SCHEDULER = "gerapy_rabbitmq.scheduler.Scheduler"
SCHEDULER_QUEUE_KEY = '%(spider)s_requests'

# RabbitMQ Connection Parameters, see https://pika.readthedocs.io/en/stable/modules/parameters.html
RABBITMQ_CONNECTION_PARAMETERS = {
    'host': 'localhost'
}

# Use Redis for dupefilter
DUPEFILTER_CLASS = "gerapy_redis.dupefilter.RFPDupeFilter"
SCHEDULER_DUPEFILTER_KEY = '%(spider)s:dupefilter'
```

Optional configuration:

```python
# RabbitMQ Queue Configuration
SCHEDULER_QUEUE_DURABLE = True
SCHEDULER_QUEUE_MAX_PRIORITY = 100
SCHEDULER_QUEUE_PRIORITY_OFFSET = 30
SCHEDULER_QUEUE_FORCE_FLUSH = True
SCHEDULER_PERSIST = False
SCHEDULER_IDLE_BEFORE_CLOSE = 0
SCHEDULER_FLUSH_ON_START = False
SCHEDULER_PRE_ENQUEUE_ALL_START_REQUESTS = True
```

## More

For more detail, you can refer to [example](./example).

## RabbitMQ Preview

![](https://qiniu.cuiqingcai.com/zjc82.png)