Skip to content

Commit 949d836

Browse files
Merge pull request #105 from alexanderjordanbaker/AsyncClient
Adding Async client backed by httpx
2 parents af4163b + e799cae commit 949d836

File tree

6 files changed

+818
-18
lines changed

6 files changed

+818
-18
lines changed

NOTICE.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,3 +666,19 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
666666
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
667667

668668
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
669+
670+
_____________________
671+
672+
Encode OSS Ltd. (httpx)
673+
674+
Copyright © 2019, Encode OSS Ltd. All rights reserved.
675+
676+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
677+
678+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
679+
680+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
681+
682+
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
683+
684+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,38 @@ timestamp = round(time.time()*1000)
139139
base64_encoded_signature = promotion_code_signature_generator.create_signature(product_id, subscription_offer_id, application_username, nonce, timestamp)
140140
```
141141

142+
### Async HTTPX Support
143+
144+
#### Pip
145+
Include the optional async dependency
146+
```sh
147+
pip install app-store-server-library[async]
148+
```
149+
150+
#### API Usage
151+
```python
152+
from appstoreserverlibrary.api_client import AsyncAppStoreServerAPIClient, APIException
153+
from appstoreserverlibrary.models.Environment import Environment
154+
155+
private_key = read_private_key("/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8") # Implementation will vary
156+
157+
key_id = "ABCDEFGHIJ"
158+
issuer_id = "99b16628-15e4-4668-972b-eeff55eeff55"
159+
bundle_id = "com.example"
160+
environment = Environment.SANDBOX
161+
162+
client = AsyncAppStoreServerAPIClient(private_key, key_id, issuer_id, bundle_id, environment)
163+
164+
try:
165+
response = await client.request_test_notification()
166+
print(response)
167+
except APIException as e:
168+
print(e)
169+
170+
# Once client use is finished
171+
await client.async_close()
172+
```
173+
142174
## Support
143175

144176
Only the latest major version of the library will receive updates, including security updates. Therefore, it is recommended to update to new major versions.

0 commit comments

Comments
 (0)