Пример #1
0
def uploadImage(path):
    with open(path, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read())
    data = {"file": str(encoded_string)[2:-1], "type": "MMS"}
    headers = get_headers(base.apiKey, base.apiSecret)
    return requests.post(base.getUrl("/storage/v1/files"),
                         headers=headers,
                         json=data)
Пример #2
0
def sendMany(data):
    return requests.post(
        base.getUrl("/messages/v4/send-many"),
        headers=get_headers(base.apiKey, base.apiSecret),
        json=data,
    )
Пример #3
0
def delete(path):
    return requests.delete(base.getUrl(path),
                           headers=get_headers(base.apiKey, base.apiSecret))
Пример #4
0
def get(path, headers={}):
    headers.update(get_headers(base.apiKey, base.apiSecret))
    return requests.get(base.getUrl(path), headers=headers)
Пример #5
0
def put(path, data, headers={}):
    headers.update(get_headers(base.apiKey, base.apiSecret))
    return requests.put(base.getUrl(path), headers=headers, json=data)
Пример #6
0
def post(path, data):
    return requests.post(
        base.getUrl(path),
        headers=get_headers(base.apiKey, base.apiSecret),
        json=data,
    )