summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-10 06:09:45 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-10 06:09:45 +0000
commit49f836a2bf4357d7a1c23afa0bdceaba9bb81f57 (patch)
tree8856a235081466baff098765e54463c09f9109fd
parent80a723c9ecb34ca3d60da10ed99d54d3574369f4 (diff)
automatic import of python-twilio
-rw-r--r--.gitignore1
-rw-r--r--python-twilio.spec197
-rw-r--r--sources2
3 files changed, 147 insertions, 53 deletions
diff --git a/.gitignore b/.gitignore
index 50c83c5..7d4f834 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/twilio-7.16.5.tar.gz
+/twilio-8.0.0.tar.gz
diff --git a/python-twilio.spec b/python-twilio.spec
index 0373195..dc76bcf 100644
--- a/python-twilio.spec
+++ b/python-twilio.spec
@@ -1,16 +1,19 @@
%global _empty_manifest_terminate_build 0
Name: python-twilio
-Version: 7.16.5
+Version: 8.0.0
Release: 1
Summary: Twilio API client and TwiML generator
License: MIT License
URL: https://github.com/twilio/twilio-python/
-Source0: https://mirrors.nju.edu.cn/pypi/web/packages/3c/42/b9c073e40fc001213e9c97b474132e7e3b7deea9088febcf97f21f1f3c04/twilio-7.16.5.tar.gz
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/bb/2d/f89b714e176b470173bda0e1d90d9ffff4d4838281b35c08fad15728ea9b/twilio-8.0.0.tar.gz
BuildArch: noarch
Requires: python3-pytz
Requires: python3-requests
Requires: python3-PyJWT
+Requires: python3-asyncio
+Requires: python3-aiohttp
+Requires: python3-aiohttp-retry
%description
# twilio-python
@@ -38,7 +41,6 @@ Please consult the [official migration guide](https://www.twilio.com/docs/librar
This library supports the following Python implementations:
-* Python 3.6
* Python 3.7
* Python 3.8
* Python 3.9
@@ -74,15 +76,26 @@ Getting started with the Twilio API couldn't be easier. Create a
### API Credentials
-The `Twilio` needs your Twilio credentials. You can either pass these
+The `Twilio` client needs your Twilio credentials. You can either pass these
directly to the constructor (see the code below) or via environment variables.
+Authenticating with Account SID and Auth Token:
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+account_sid = "ACXXXXXXXXXXXXXXXXX"
+auth_token = "YYYYYYYYYYYYYYYYYY"
+client = Client(account_sid, auth_token)
+```
+
+Authenticating with API Key and API Secret:
+```python
+from twilio.rest import Client
+
+api_key = "XXXXXXXXXXXXXXXXX"
+api_secret = "YYYYYYYYYYYYYYYYYY"
+account_sid = "ACXXXXXXXXXXXXXXXXX"
+client = Client(api_key, api_secret, account_sid)
```
Alternatively, a `Client` constructor without these parameters will
@@ -127,9 +140,9 @@ This will result in the `hostname` transforming from `api.twilio.com` to `api.sy
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
call = client.calls.create(to="9991231234",
from_="9991231234",
@@ -142,14 +155,34 @@ print(call.sid)
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
message = client.messages.create(to="+12316851234", from_="+15555555555",
body="Hello there!")
```
+### Asynchronous API Requests
+
+By default, the Twilio Client will make synchronous requests to the Twilio API. To allow for asynchronous, non-blocking requests, we've included an optional asynchronous HTTP client. When used with the Client and the accompanying `*_async` methods, requests made to the Twilio API will be performed asynchronously.
+
+```python
+from twilio.http.async_http_client import AsyncTwilioHttpClient
+from twilio.rest import Client
+
+async def main():
+ username = "ACXXXXXXXXXXXXXXXXX"
+ password = "YYYYYYYYYYYYYYYYYY"
+ http_client = AsyncTwilioHttpClient()
+ client = Client(username, password, http_client=http_client)
+
+ message = await client.messages.create_async(to="+12316851234", from_="+15555555555",
+ body="Hello there!")
+
+asyncio.run(main())
+```
+
### Enable Debug Logging
Log the API request and response data to the console:
@@ -157,7 +190,7 @@ Log the API request and response data to the console:
```python
import logging
-client = Client(account, token)
+client = Client(username, password)
logging.basicConfig()
client.http_client.logger.setLevel(logging.INFO)
```
@@ -167,7 +200,7 @@ Log the API request and response data to a file:
```python
import logging
-client = Client(account, token)
+client = Client(username, password)
logging.basicConfig(filename='./log.txt')
client.http_client.logger.setLevel(logging.INFO)
```
@@ -178,9 +211,9 @@ client.http_client.logger.setLevel(logging.INFO)
from twilio.rest import Client
from twilio.base.exceptions import TwilioRestException
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
try:
message = client.messages.create(to="+12316851234", from_="+15555555555",
@@ -261,7 +294,6 @@ Please consult the [official migration guide](https://www.twilio.com/docs/librar
This library supports the following Python implementations:
-* Python 3.6
* Python 3.7
* Python 3.8
* Python 3.9
@@ -297,15 +329,26 @@ Getting started with the Twilio API couldn't be easier. Create a
### API Credentials
-The `Twilio` needs your Twilio credentials. You can either pass these
+The `Twilio` client needs your Twilio credentials. You can either pass these
directly to the constructor (see the code below) or via environment variables.
+Authenticating with Account SID and Auth Token:
+```python
+from twilio.rest import Client
+
+account_sid = "ACXXXXXXXXXXXXXXXXX"
+auth_token = "YYYYYYYYYYYYYYYYYY"
+client = Client(account_sid, auth_token)
+```
+
+Authenticating with API Key and API Secret:
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+api_key = "XXXXXXXXXXXXXXXXX"
+api_secret = "YYYYYYYYYYYYYYYYYY"
+account_sid = "ACXXXXXXXXXXXXXXXXX"
+client = Client(api_key, api_secret, account_sid)
```
Alternatively, a `Client` constructor without these parameters will
@@ -350,9 +393,9 @@ This will result in the `hostname` transforming from `api.twilio.com` to `api.sy
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
call = client.calls.create(to="9991231234",
from_="9991231234",
@@ -365,14 +408,34 @@ print(call.sid)
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
message = client.messages.create(to="+12316851234", from_="+15555555555",
body="Hello there!")
```
+### Asynchronous API Requests
+
+By default, the Twilio Client will make synchronous requests to the Twilio API. To allow for asynchronous, non-blocking requests, we've included an optional asynchronous HTTP client. When used with the Client and the accompanying `*_async` methods, requests made to the Twilio API will be performed asynchronously.
+
+```python
+from twilio.http.async_http_client import AsyncTwilioHttpClient
+from twilio.rest import Client
+
+async def main():
+ username = "ACXXXXXXXXXXXXXXXXX"
+ password = "YYYYYYYYYYYYYYYYYY"
+ http_client = AsyncTwilioHttpClient()
+ client = Client(username, password, http_client=http_client)
+
+ message = await client.messages.create_async(to="+12316851234", from_="+15555555555",
+ body="Hello there!")
+
+asyncio.run(main())
+```
+
### Enable Debug Logging
Log the API request and response data to the console:
@@ -380,7 +443,7 @@ Log the API request and response data to the console:
```python
import logging
-client = Client(account, token)
+client = Client(username, password)
logging.basicConfig()
client.http_client.logger.setLevel(logging.INFO)
```
@@ -390,7 +453,7 @@ Log the API request and response data to a file:
```python
import logging
-client = Client(account, token)
+client = Client(username, password)
logging.basicConfig(filename='./log.txt')
client.http_client.logger.setLevel(logging.INFO)
```
@@ -401,9 +464,9 @@ client.http_client.logger.setLevel(logging.INFO)
from twilio.rest import Client
from twilio.base.exceptions import TwilioRestException
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
try:
message = client.messages.create(to="+12316851234", from_="+15555555555",
@@ -481,7 +544,6 @@ Please consult the [official migration guide](https://www.twilio.com/docs/librar
This library supports the following Python implementations:
-* Python 3.6
* Python 3.7
* Python 3.8
* Python 3.9
@@ -517,15 +579,26 @@ Getting started with the Twilio API couldn't be easier. Create a
### API Credentials
-The `Twilio` needs your Twilio credentials. You can either pass these
+The `Twilio` client needs your Twilio credentials. You can either pass these
directly to the constructor (see the code below) or via environment variables.
+Authenticating with Account SID and Auth Token:
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+account_sid = "ACXXXXXXXXXXXXXXXXX"
+auth_token = "YYYYYYYYYYYYYYYYYY"
+client = Client(account_sid, auth_token)
+```
+
+Authenticating with API Key and API Secret:
+```python
+from twilio.rest import Client
+
+api_key = "XXXXXXXXXXXXXXXXX"
+api_secret = "YYYYYYYYYYYYYYYYYY"
+account_sid = "ACXXXXXXXXXXXXXXXXX"
+client = Client(api_key, api_secret, account_sid)
```
Alternatively, a `Client` constructor without these parameters will
@@ -570,9 +643,9 @@ This will result in the `hostname` transforming from `api.twilio.com` to `api.sy
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
call = client.calls.create(to="9991231234",
from_="9991231234",
@@ -585,14 +658,34 @@ print(call.sid)
```python
from twilio.rest import Client
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
message = client.messages.create(to="+12316851234", from_="+15555555555",
body="Hello there!")
```
+### Asynchronous API Requests
+
+By default, the Twilio Client will make synchronous requests to the Twilio API. To allow for asynchronous, non-blocking requests, we've included an optional asynchronous HTTP client. When used with the Client and the accompanying `*_async` methods, requests made to the Twilio API will be performed asynchronously.
+
+```python
+from twilio.http.async_http_client import AsyncTwilioHttpClient
+from twilio.rest import Client
+
+async def main():
+ username = "ACXXXXXXXXXXXXXXXXX"
+ password = "YYYYYYYYYYYYYYYYYY"
+ http_client = AsyncTwilioHttpClient()
+ client = Client(username, password, http_client=http_client)
+
+ message = await client.messages.create_async(to="+12316851234", from_="+15555555555",
+ body="Hello there!")
+
+asyncio.run(main())
+```
+
### Enable Debug Logging
Log the API request and response data to the console:
@@ -600,7 +693,7 @@ Log the API request and response data to the console:
```python
import logging
-client = Client(account, token)
+client = Client(username, password)
logging.basicConfig()
client.http_client.logger.setLevel(logging.INFO)
```
@@ -610,7 +703,7 @@ Log the API request and response data to a file:
```python
import logging
-client = Client(account, token)
+client = Client(username, password)
logging.basicConfig(filename='./log.txt')
client.http_client.logger.setLevel(logging.INFO)
```
@@ -621,9 +714,9 @@ client.http_client.logger.setLevel(logging.INFO)
from twilio.rest import Client
from twilio.base.exceptions import TwilioRestException
-account = "ACXXXXXXXXXXXXXXXXX"
-token = "YYYYYYYYYYYYYYYYYY"
-client = Client(account, token)
+username = "ACXXXXXXXXXXXXXXXXX"
+password = "YYYYYYYYYYYYYYYYYY"
+client = Client(username, password)
try:
message = client.messages.create(to="+12316851234", from_="+15555555555",
@@ -673,7 +766,7 @@ If you've instead found a bug in the library or would like new features added, g
%prep
-%autosetup -n twilio-7.16.5
+%autosetup -n twilio-8.0.0
%build
%py3_build
@@ -713,5 +806,5 @@ mv %{buildroot}/doclist.lst .
%{_docdir}/*
%changelog
-* Thu Mar 09 2023 Python_Bot <Python_Bot@openeuler.org> - 7.16.5-1
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 8.0.0-1
- Package Spec generated
diff --git a/sources b/sources
index 375a50e..1b48c47 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-5cdd49d122f210a41fbef54bda93d713 twilio-7.16.5.tar.gz
+c59d5e39b400de8fbcd38f471a9b97d9 twilio-8.0.0.tar.gz