semvec/pypi-packages huggingface dataset:
opencpaas 0.0.1
An SDK that allows flexibility between CPaaS providers.

# OpenCpaas Python SDK

OpenCpaas allows customers to switch between CpaaS providers without having to rewrite code.

Currently supports:

- Bandwidth
- Twilio

See our [full documentation]().

## Requirements

- [Python](https://www.python.org/downloads/) 3.5+

## Installation

```python
pip install opencpaas
```

## Getting Started

### Client Initialization

Begin by initializing a new CpaaS client. This example uses the BandwidthClient for initialization. Specifics for each client can be found in each client's repository.

```python
import opencpaas

auth = 	{
	'api_token': '789',
	'api_secret':'1011',
	'account_id': 'myaccount' ,
	'application_id': 'myapplication',
	'user': 'username',
	'pass': 'password',
	'site_id': '12345' 
	}

client = BandwidthClient(auth)

```

Each type of CpaaS client will require different authentications. Refer to our documentation for a complete list.

### Send an SMS

```python
message = client.send_sms(to="+12223334444"
                          from_="+12223334445"
                          text="Hello there!")

print(message['id'])
```

### Send an MMS

```python
message = client.send_mms(to="+12223334444"
                          from_="+12223334445"
                          text="Take a look at this!"
                          media_url="www.media.com/cute-cat")

print(message['id'])
```

### Order a phone number
```python
result = client.order_number(phone_number="+12223334444")

print(result['order_status'])
```

### Order multiple phone numbers
```python
result = client.order_numbers(area_code="410"
                              quantity=10)

print(result['order_status'])
```

### Make an outgoing phone call
```python
parameters = {
          'url':"http://mycallbackurl.com/123",
          'status_callback':"http://mystatuscallbackurl.com/123",
          'answer_url':"http://myanswerurl.com/123"
          }

call_id = client.create_call(to="+12223334444",
                             from_="+12223334445",
                             **parameters
                             )

print(call_id)
```
CpaaS clients require different callback urls. Please check our documentation for specific information on these urls.
jsonseq 1.0.0
Python support for RFC 7464 JSON text sequences
Keywords: json rfc7464

# jsonseq

[RFC 7464 JSON Text Sequences](https://tools.ietf.org/html/rfc7464) encoding and decoding for Python.

[![Build
Status](https://travis-ci.com/sgillies/jsonseq.svg?branch=master)](https://travis-ci.com/sgillies/jsonseq)
[![Coverage
Status](https://coveralls.io/repos/github/sgillies/jsonseq/badge.svg?branch=master)](https://coveralls.io/github/sgillies/jsonseq?branch=master)
[![Documentation Status](https://readthedocs.org/projects/jsonseq/badge/?version=latest)](https://jsonseq.readthedocs.io/en/latest/?badge=latest)

## Usage

The `jsonseq.encode.JSONSeqEncoder` class takes streams of JSON-serializable
Python objects and yields for each object its JSON representation sandwiched
between an optional ASCII record separator (RS, `\x1e`) and a newline (`\n`).

```python
>>> from jsonseq.encode import JSONSeqEncoder
>>> for chunk in JSONSeqEncoder().encode(({"a": i, "b": i} for i in range(3))):
...     print(repr(chunk))
...
'{"a": 0, "b": 0}\n'
'{"a": 1, "b": 1}\n'
'{"a": 2, "b": 2}\n'
```

The RS allows pretty-printed JSON to be streamed out in sequences that can be
decoded again.

```python
>>> for chunk in JSONSeqEncoder(with_rs=True, indent=2).encode(({"a": i, "b": i} for i in range(3))):
...     print(repr(chunk))
...
'\x1e{\n  "a": 0,\n  "b": 0\n}\n'
'\x1e{\n  "a": 1,\n  "b": 1\n}\n'
'\x1e{\n  "a": 2,\n  "b": 2\n}\n'
```

You can also get small chunks of the JSON sequences as they are encoded with
the `iterencode()` method.

```python
>>> for chunk in JSONSeqEncoder(with_rs=True).iterencode(({"a": i} for i in range(3))):
...     print(repr(chunk))
...
'\x1e'
'{'
'"a"'
': '
'0'
'}'
'\n'
'\x1e'
'{'
'"a"'
': '
'1'
'}'
'\n'
'\x1e'
'{'
'"a"'
': '
'2'
'}'
'\n'
```

You can use either `encode()` or `iterencode()` to copy JSON text sequences to a file.

```python
with open("/tmp/example.jsons", "w") as f:
    for chunk in JSONSeqEncoder(with_rs=True, indent=2).iterencode(({"a": i, "b": i} for i in range(3))):
        f.write(chunk)
```

There is no need to add a newline when calling the file's `write()` method.
JSONSeqEncoder ensures that it's already there where it needs to be.

The `jsonseq.decode.JSONSeqDecoder` class takes streams of JSON texts
sandwiched between the optional ASCII record separator (RS, `\x1e`) and
a newline (`\n`) and yields decoded Python objects.

```python
>>> stream = ['\x1e', '{', '"a"', ': ', '0', '}', '\n', '\x1e', '{', '"a"', ': ', '1', '}', '\n', '\x1e', '{', '"a"', ': ', '2', '}', '\n']
>>> for obj in JSONSeqDecoder().decode(stream):
...     print(repr(obj))
...
{'a': 0}
{'a': 1}
{'a': 2}
```

Objects can be read from a file in the same way.

```python
>>> with open("/tmp/example.jsons") as f:
...     for obj in JSONSeqDecoder().decode(f):
...         print(repr(obj))
...
{'a': 0, 'b': 0}
{'a': 1, 'b': 1}
{'a': 2, 'b': 2}
````