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
ID | STCD_0000000018 |
Language | Python |
Steps | 61 |
Purpose | Pay by PayPal |
Function | send POST with Query send POST with Mutation |
Environment | Windows 10 Anaconda3(Python 3.10.9) IDE : Visual Studio Code |
Restriction | free license You can use source code copy as owner . You can customize and distribute it freely. |
Price | 7 dollars or 700 yen (Pay with PayPal) |
References | https://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
NO | test case | result |
01 | Send GET(to get GraphQL Playground interface) to GraphQL server . | OK |
02 | Send POST(query) to GraphQL server . | OK |
03 | Send 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 passwordSTCD_0000000018
1 file(s) 0.18 KB
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