GraphQL sample code

For programmers to need to call api by Python using GraphQL,this tested source code is useful. This sample code includes client/server code and you can use it as template of GraphQL.

Specification

IDSTCD_0000000018
LanguagePython
Steps61
PurposePay by PayPal
Functionsend POST with Query
send POST with Mutation
EnvironmentWindows 10
Anaconda3(Python 3.10.9)
IDE : Visual Studio Code
Restrictionfree license
You can use source code copy as owner .
You can customize and distribute it freely.
Price7 dollars or 700 yen
(Pay with PayPal)
Referenceshttps://blog.logrocket.com/build-graphql-api-python-flask-ariadne/
https://www.aeyescan.jp/media/openapi
https://blog.sethcorker.com/how-to-create-a-react-flask-graphql-project/

Source Code

  • Client( = Test Code)
  • Server

Test Result

NOtest caseresult
01Send GET(to get GraphQL Playground interface) to GraphQL server .OK
02Send POST(query) to GraphQL server .OK
03Send POST(mutation) to GraphQL server .OK

History

19/11/2023 created

Provider Profile

Nick name is “Dead Fish” employed as an engineer in Japan.
I am grad if you need my code.
Thanks !

Download

Get download password

Following files and data are zipped.

├── key_store
│   ├── server.crt
│   └── server.key
├── test_graphql_client.py
└── test_graphql_server.py

Remarks

To run server using flask embedded web server, refer to following :

> set FLASK_APP=test_graphql_server
> flask run --cert key_store/server.crt --key key_store/server.key --port=50443
 * Serving Flask app 'test_graphql_server'
 * Debug mode: off
Enter PEM pass phrase: <test>
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on https://127.0.0.1:50443
Press CTRL+C to quit

None

Comments

Copied title and URL