New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

graphql-example

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-example - pypi Package Compare versions

Comparing version
0.3.2
to
0.4.0
+1
-1
graphql_example.egg-info/PKG-INFO
Metadata-Version: 1.1
Name: graphql-example
Version: 0.3.2
Version: 0.4.0
Summary: A simple graphql server

@@ -5,0 +5,0 @@ Home-page: https://github.com/knowsuchagency/graphql-example

@@ -28,2 +28,3 @@ attrs

jupyter-contrib-nbextensions
markdown

@@ -47,2 +48,3 @@ [development]

jupyter-contrib-nbextensions
markdown

@@ -66,2 +68,3 @@ [test]

jupyter-contrib-nbextensions
markdown

@@ -85,1 +88,2 @@ [testing]

jupyter-contrib-nbextensions
markdown

@@ -7,2 +7,2 @@ # -*- coding: utf-8 -*-

__email__ = 'knowsuchagency@gmail.com'
__version__ = '0.3.2'
__version__ = '0.4.0'
# coding: utf-8
# In[1]:
# In[8]:

@@ -57,3 +57,5 @@

import markdown
# # graphql + aiohttp

@@ -239,2 +241,50 @@

# In[9]:
template = """
# Welcome to the example page
## Rest routes
### Authors
For an individual author:
[/rest/author/{{id}}](/rest/author/1)
To query authors:
[/rest/authors?age={{number}}&limit={{another_number}}](/rest/authors?limit=3)
The following can be passed as query parameters to authors:
limit: The amount of results you wish to be limited to
age: The age of the author, as an integer
first_name: The first name of the author as a string
last_name: The last name of the author as a string
no_books: Removes the {{books}} field from the resulting authors
### Books
For an individual book:
[/rest/book/{{id}}](/rest/book/1)
To query books:
[/rest/books?author_id={{number}}&limit={{another_number}}](/rest/books?limit=3)
The following can be passed as query parameters to books:
limit: The amount of results you wish to be limiited to
title: The title of the book
published: The date published in the following format %m/%d/%Y
author_id: The uuid of the author in the database
"""
html = markdown.markdown(template)
# In[3]:

@@ -244,3 +294,3 @@

#@routes.get('/')
async def index_view(request):
async def index(request):
"""Redirect to greet route."""

@@ -250,27 +300,12 @@ # this logging sexiness is a talk for another time

with log_request(request):
url = request.app.router['greet'].url_for(name='you')
with log_action('redirect', to_url=str(url)):
return web.HTTPFound(url)
#@routes.get('/greet/{name}', name='greet')
async def greet_view(request):
"""Say hello."""
with log_request(request):
response = web.Response(
text=html,
content_type='Content-Type: text/html'
)
name = request.match_info['name']
response = web.Response(
text=f'<html><h2>Hello {name}!</h2><html>',
content_type='Content-Type: text/html'
)
with log_response(response):
return response
with log_response(response):
return response
# # Rest views

@@ -392,5 +427,5 @@ #

with log_response(response):
with log_response(response):
return response
return response

@@ -432,5 +467,5 @@

with log_response(response):
with log_response(response):
return response
return response

@@ -643,4 +678,3 @@

# example routes
app.router.add_get('/', index_view)
app.router.add_get('/greet/{name}', greet_view, name='greet')
app.router.add_get('/', index)

@@ -647,0 +681,0 @@ # rest routes

@@ -18,3 +18,3 @@ from contextlib import contextmanager

with log_action(
'processing request',
'receiving request',

@@ -21,0 +21,0 @@ method=request.method,

@@ -38,1 +38,2 @@ [[source]]

jupyter-contrib-nbextensions = "*"
markdown = "*"
Metadata-Version: 1.1
Name: graphql-example
Version: 0.3.2
Version: 0.4.0
Summary: A simple graphql server

@@ -5,0 +5,0 @@ Home-page: https://github.com/knowsuchagency/graphql-example

+61
-28

@@ -53,2 +53,4 @@

from aiohttp import web
import markdown
```

@@ -237,4 +239,51 @@

```python
template = """
# Welcome to the example page
## Rest routes
### Authors
For an individual author:
[/rest/author/{{id}}](/rest/author/1)
To query authors:
[/rest/authors?age={{number}}&limit={{another_number}}](/rest/authors?limit=3)
The following can be passed as query parameters to authors:
limit: The amount of results you wish to be limited to
age: The age of the author, as an integer
first_name: The first name of the author as a string
last_name: The last name of the author as a string
no_books: Removes the {{books}} field from the resulting authors
### Books
For an individual book:
[/rest/book/{{id}}](/rest/book/1)
To query books:
[/rest/books?author_id={{number}}&limit={{another_number}}](/rest/books?limit=3)
The following can be passed as query parameters to books:
limit: The amount of results you wish to be limiited to
title: The title of the book
published: The date published in the following format %m/%d/%Y
author_id: The uuid of the author in the database
"""
html = markdown.markdown(template)
```
```python
#@routes.get('/')
async def index_view(request):
async def index(request):
"""Redirect to greet route."""

@@ -244,25 +293,10 @@ # this logging sexiness is a talk for another time

with log_request(request):
url = request.app.router['greet'].url_for(name='you')
with log_action('redirect', to_url=str(url)):
return web.HTTPFound(url)
#@routes.get('/greet/{name}', name='greet')
async def greet_view(request):
"""Say hello."""
with log_request(request):
response = web.Response(
text=html,
content_type='Content-Type: text/html'
)
name = request.match_info['name']
response = web.Response(
text=f'<html><h2>Hello {name}!</h2><html>',
content_type='Content-Type: text/html'
)
with log_response(response):
return response
with log_response(response):
return response
```

@@ -383,5 +417,5 @@

with log_response(response):
with log_response(response):
return response
return response
```

@@ -422,5 +456,5 @@

with log_response(response):
with log_response(response):
return response
return response
```

@@ -630,4 +664,3 @@

# example routes
app.router.add_get('/', index_view)
app.router.add_get('/greet/{name}', greet_view, name='greet')
app.router.add_get('/', index)

@@ -634,0 +667,0 @@ # rest routes

[metadata]
name = graphql-example
version = 0.3.2
version = 0.4.0
description = A simple graphql server

@@ -5,0 +5,0 @@ long_description = file: README.rst