forked from anvilco/python-anvil
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforge_submit.py
More file actions
34 lines (25 loc) · 956 Bytes
/
forge_submit.py
File metadata and controls
34 lines (25 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
from python_anvil.api import Anvil
from python_anvil.api_resources.payload import ForgeSubmitPayload
API_KEY = os.environ.get("ANVIL_API_KEY")
# or set your own key here
# API_KEY = 'my-api-key'
def main():
anvil = Anvil(api_key=API_KEY)
# Your ForgeSubmit payload.
# In this example, we have a basic Webform containing a name and email field.
# For both fields, we are using the field's eid which can be found in the
# weld or forge GraphQL query.
# More info here: https://www.useanvil.com/docs/api/graphql/reference/#definition-Forge
payload = ForgeSubmitPayload(
forge_eid="myForgeEidHere",
payload=dict(
forge16401fc09c3e11ed85f5a91873b464b4="FirstName LastName",
forge1b57aeb09c3e11ed85f5a91873b464b4="[email protected]",
),
)
# Submit the above payload
res = anvil.forge_submit(payload)
print(res)
if __name__ == '__main__':
main()