Skip to content
Merged
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
30 changes: 30 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Coral AIOHTTP - Docs

on:
push:
branches:
- main

jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.13
- name: Install dependencies
run: poetry install
- name: Build And Commit Site
run: |
poetry run mkdocs build
git config user.name github-actions
git config user.email github-actions@github.com
git add site
git commit -m "ci: build and commit documentation"
git push
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Coral AIOHTTP - Publish

on:
release:
types: [published]

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.13
- name: Install dependencies
run: poetry install
- name: Publish
run: poetry publish --build --username "${{secrets.PYPI_USERNAME}}" --password "${{secrets.PYPI_PASSWORD}}" --no-interaction
30 changes: 30 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Coral AIOHTTP - Pytest

on: [push]

jobs:
test:

strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
poetry-version: ["1.1.13"]
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: poetry install
- name: Run Pytest
run: poetry run pytest --cov=src --cov-report=xml
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site

.idea/

# install stamp
Expand Down
Empty file added .nojekyll
Empty file.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Daniel Seifert

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Qlient AIOHTTP: Python GraphQL Client

[![DeepSource](https://deepsource.io/gh/qlient-org/python-qlient-aiohttp.svg/?label=active+issues&token=2ZJ0b1dinekjVtwgJHSy286C)](https://deepsource.io/gh/qlient-org/python-qlient-aiohttp/?ref=repository-badge)
[![DeepSource](https://deepsource.io/gh/qlient-org/python-qlient-aiohttp.svg/?label=resolved+issues&token=2ZJ0b1dinekjVtwgJHSy286C)](https://deepsource.io/gh/qlient-org/python-qlient-aiohttp/?ref=repository-badge)
[![pypi](https://img.shields.io/pypi/v/qlient-aiohttp.svg)](https://pypi.python.org/pypi/qlient-aiohttp)
[![versions](https://img.shields.io/pypi/pyversions/qlient-aiohttp.svg)](https://github.com/qlient-org/python-qlient-aiohttp)
[![license](https://img.shields.io/github/license/qlient-org/python-qlient-aiohttp.svg)](https://github.com/qlient-org/python-qlient-aiohttp/blob/master/LICENSE)

A blazingly fast and modern graphql client based on qlient-core and aiohttp

## Key Features

* Compatible with Python 3.7 and above
* Build on top of ``qlient-core`` and ``aiohttp``
* support for subscriptions

## Help

See the [documentation](https://qlient-org.github.io/python-qlient-aiohttp/site/) for more details.

## Quick Preview

_This preview is using the official [github/graphql/swapi-graphql]() graphql api._

```python
import asyncio

from qlient.aiohttp import AIOHTTPClient, GraphQLResponse


async def main():
async with AIOHTTPClient("https://swapi-graphql.netlify.app/.netlify/functions/index") as client:
result: GraphQLResponse = await client.query.film(
["title", "id"], # fields selection
id="ZmlsbXM6MQ==" # query arguments
)

print(result.request.query)
print(result.data)


asyncio.run(main())
```

Which results in the following query being sent to the server

```graphql
query film($id: ID) {
film(id: $id) {
title
id
}
}
```

And returns the body below

```json
{
"film": {
"title": "A New Hope",
"id": "ZmlsbXM6MQ=="
}
}
```
9 changes: 9 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# API

## Clients

::: qlient.aiohttp.clients

## Backends

::: qlient.aiohttp.backends
60 changes: 60 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Introduction

[![DeepSource](https://deepsource.io/gh/qlient-org/python-qlient-aiohttp.svg/?label=active+issues&token=2ZJ0b1dinekjVtwgJHSy286C)](https://deepsource.io/gh/qlient-org/python-qlient-aiohttp/?ref=repository-badge)
[![DeepSource](https://deepsource.io/gh/qlient-org/python-qlient-aiohttp.svg/?label=resolved+issues&token=2ZJ0b1dinekjVtwgJHSy286C)](https://deepsource.io/gh/qlient-org/python-qlient-aiohttp/?ref=repository-badge)
[![pypi](https://img.shields.io/pypi/v/qlient-aiohttp.svg)](https://pypi.python.org/pypi/qlient-aiohttp)
[![versions](https://img.shields.io/pypi/pyversions/qlient-aiohttp.svg)](https://github.com/qlient-org/python-qlient-aiohttp)
[![license](https://img.shields.io/github/license/qlient-org/python-qlient-aiohttp.svg)](https://github.com/qlient-org/python-qlient-aiohttp/blob/master/LICENSE)

A blazingly fast and modern graphql client based on qlient-core and aiohttp

## Key Features

* Compatible with Python 3.7 and above
* Build on top of ``qlient-core`` and ``aiohttp``

## Quick Preview

_This preview is using the official [github/graphql/swapi-graphql]() graphql api._

```python
import asyncio

from qlient.aiohttp import AIOHTTPClient, GraphQLResponse


async def main():
async with AIOHTTPClient("https://swapi-graphql.netlify.app/.netlify/functions/index") as client:
result: GraphQLResponse = await client.query.film(
["title", "id"], # fields selection
id="ZmlsbXM6MQ==" # query arguments
)

print(result.request.query)
print(result.data)


asyncio.run(main())
```

Which results in the following query being sent to the server

```graphql
query film($id: ID) {
film(id: $id) {
title
id
}
}
```

And returns the body below

```json
{
"film": {
"title": "A New Hope",
"id": "ZmlsbXM6MQ=="
}
}
```
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting</title>
<noscript>
<meta http-equiv="refresh" content="1; url=site/"/>
</noscript>
<script>
window.location.replace("site/" + window.location.hash);
</script>
</head>
<body>
Redirecting to <a href="site/">site/</a>...
</body>
</html>
5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
site_name: qlient-aiohttp
site_url: https://qlient-org.github.io/python-qlient-aiohttp/
site_description: A fast and modern graphql client library designed with simplicity in mind.
site_description: A blazingly fast and modern graphql client based on qlient-core and aiohttp

strict: false

Expand Down Expand Up @@ -34,4 +34,5 @@ markdown_extensions:

plugins:
- include-markdown
- search
- search
- mkdocstrings
Loading