Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some enhancements in docs and source code. #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 5 additions & 105 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,107 +1,7 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# my ignores
.pypirc
.env*
.venv*
env*
venv*
ENV
125 changes: 57 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,121 +1,110 @@
# kavenegar-python
<a href="http://kavenegar.com">
<img width="300px" src="http://kavenegar.com/images/logo.svg" />
</a>

# <a href="http://kavenegar.com/rest.html">Kavenegar RESTful API Document</a>
If you need to future information about API document Please visit RESTful Document
# Kavenegar Python Client

[![PyPI version](https://badge.fury.io/py/kavenegar.svg)](https://badge.fury.io/py/kavenegar)

For more information about Kavenegar RESTful API, you can visit <a href="http://kavenegar.com/rest.html" target="_blank">Kavenegar RESTful API documnets</a>.

## Installation
<p> You can install our SDK from pypi through below command </p>

<p>Use the following command to install Kavenegar python client:</p>

```
pip install kavenegar
```
You can download the Python SDK <a href="https://github.com/KaveNegar/kavenegar-python/blob/master/kavenegar.py">Here</a> too
<p>
Then ,You need to make an account on Kavenegar from <a href="https://panel.kavenegar.com/Client/Membership/Register">Here</a>
</p>
<p>
After that you just need to pick API-KEY up from <a href="http://panel.kavenegar.com/Client/setting/index">My Account</a> section.

Anyway there is good tutorial about <a href="http://gun.io/blog/how-to-github-fork-branch-and-pull-request/">Pull request</a>
</p>
After the installation completed, create your Kavenegar account from <a href="https://panel.kavenegar.com/Client/Membership/Register">here</a>. Then you can access to your `API-KEY` from <a href="http://panel.kavenegar.com/Client/setting/account">your account settings section</a>.

## Usage

Well, There is an example to Send SMS by Python below. `timeout` parameter is optional in `KavenegarAPI` constructor, default value is set to 10 seconds.
Well, here you can find some examples on how to use `kavenegar` for sending sms, one-time password (OTP) and group sms. `timeout` parameter is optional in `KavenegarAPI` constructor and you can specify this as much as you want (default value is 10 seconds).

### Send SMS

### Send
```python
from kavenegar import *

try:
api = KavenegarAPI('Your APIKey', timeout=20)
params = {
'sender': '',#optional
'receptor': '',#multiple mobile number, split by comma
'message': '',
}
'sender': '10006001001010', # optional
'receptor': '09123456789', # multiple mobile number, splited by comma.
'message': 'Your message here!'
}
response = api.sms_send(params)
print(response)
except APIException as e:
except APIException as e:
print(e)
except HTTPException as e:
except HTTPException as e:
print(e)
```
### OTP

### Send OTP

```python
#!/usr/bin/env python
from kavenegar import *

try:
api = KavenegarAPI('Your APIKey', timeout=20)
params = {
'receptor': '',
'receptor': '09123456789',
'template': '',
'token': '',
'type': 'sms',#sms vs call
}
response = api.verify_lookup(params)
print(response)
except APIException as e:
print(e)
except HTTPException as e:
print(e)
'token': 'The token here!',
'type': 'sms' # You can use sms or call
}
response = api.verify_lookup(params)
print(response)
except APIException as e:
print(e)
except HTTPException as e:
print(e)
```
### Send Bulk

### Send Bulk SMS

```python
#!/usr/bin/env python
from kavenegar import *

try:
api = KavenegarAPI('Your APIKey', timeout=20)
params = {
'sender':'["",""]',#array of string as json
'receptor': '["",""]',#array of string as json
'message': '["",""]',#array of string as json
}
'sender': '["10006001001010", "10001000033300"]',
'receptor': '["09123456789", "09123456788"]',
'message': '["Your message here!", "Another message here!"]'
}
response = api.sms_sendarray(params)
print(response)
except APIException as e:
except APIException as e:
print(e)
except HTTPException as e:
except HTTPException as e:
print(e)
```

# Contribution
Bug fixes, docs, and enhancements welcome! Please let us know <a href="mailto:[email protected]?Subject=SDK" target="_top">[email protected]</a>
<hr>
<div dir='rtl'>

## راهنما

### معرفی سرویس کاوه نگار
# Kavenegar Guide

کاوه نگار یک وب سرویس ارسال و دریافت پیامک و تماس صوتی است که به راحتی میتوانید از آن استفاده نمایید.
## Kavenegar Introduction

### ساخت حساب کاربری
Kavenegar is service that is easy to use for send and receive sms and voice calls.

اگر در وب سرویس کاوه نگار عضو نیستید میتوانید از [لینک عضویت](http://panel.kavenegar.com/client/membership/register) ثبت نام و اکانت آزمایشی برای تست API دریافت نمایید.
## Create Account

### مستندات
If you didn't join us already, use <a href="http://panel.kavenegar.com/client/membership/register">registration page</a>.

برای مشاهده اطلاعات کامل مستندات [وب سرویس پیامک](http://kavenegar.com/وب-سرویس-پیامک.html) به صفحه [مستندات وب سرویس](http://kavenegar.com/rest.html) مراجعه نمایید.
## Documents

### راهنمای فارسی
For more information about <a href="http://kavenegar.com/وب-سرویس-پیامک.htm">Kavenegar sms service</a>, follow <a href="http://kavenegar.com/rest.html">RESTful API documents</a>.

در صورتی که مایل هستید راهنمای فارسی کیت توسعه کاوه نگار را مطالعه کنید به صفحه [کد ارسال پیامک](http://kavenegar.com/sdk.html) مراجعه نمایید.
## Persian Guide

### اطالاعات بیشتر
برای مطالعه بیشتر به صفحه معرفی
[وب سرویس اس ام اس ](http://kavenegar.com)
کاوه نگار
مراجعه نمایید .
You can find persian documents of different Kavenegar clients, <a href="http://kavenegar.com/sdk.html">here</a>.

اگر در استفاده از کیت های سرویس کاوه نگار مشکلی یا پیشنهادی داشتید ما را با یک Pull Request یا ارسال ایمیل به [email protected] خوشحال کنید.

##
![http://kavenegar.com](http://kavenegar.com/public/images/logo.png)
# Contribution

[http://kavenegar.com](http://kavenegar.com)
Feel free to report any bug or problem by creating issue or sending email to our support team, or enhance docs or code and so on by creating PR (You can use this <a href="http://gun.io/blog/how-to-github-fork-branch-and-pull-request/">tutorial</a> to learn how to create fork from a project ,then create PR to main project).
For more information, visit <a href="http://kavenegar.com">our website</a>.
Contact us <a href="mailto:[email protected]?Subject=SDK" target="_top">[email protected]</a>.

</div>



Loading