Skip to content

Commit 5654664

Browse files
ahujamohleebyron
authored andcommitted
python hello world fix (graphql#486)
* python hello world example fix * fixing code
1 parent f0ba15a commit 5654664

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

site/code/index.html.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,14 @@ Then run \`python hello.py\` with this code in \`hello.py\`:
322322
import graphene
323323
324324
class Query(graphene.ObjectType):
325-
hello = graphene.String()
325+
hello = graphene.String(name=graphene.String(default_value="World"))
326326
327-
def resolve_hello(self, args, context, info):
328-
return 'Hello world!'
327+
def resolve_hello(self, info, name):
328+
return 'Hello ' + name
329329
330330
schema = graphene.Schema(query=Query)
331331
result = schema.execute('{ hello }')
332-
print(result.data['hello'])
332+
print(result.data['hello']) # "Hello World"
333333
\`\`\`
334334
335335
There are also nice bindings for [Relay](https://facebook.github.io/relay/), Django, SQLAlchemy, and Google App Engine.

0 commit comments

Comments
 (0)