Here is the example script that I tried:
test.py:
import pydgraph
client_stub = pydgraph.DgraphClientStub.from_slash_endpoint("https://ancient-lake.us-west-2.aws.cloud.dgraph.io/graphql", <api-key>)
client = pydgraph.DgraphClient(client_stub)
txn = client.txn()
p = {
'dgraph.type' : 'User',
'username' : 'KrisR'
}
try:
txn.mutate(set_obj=p)
txn.commit()
finally:
txn.discard()
I get the following error. Can you please help?
File "dgraphaccess.py", line 11, in <module>
txn.mutate(set_obj=p)
File "/usr/local/lib/python3.8/dist-packages/pydgraph/txn.py", line 75, in mutate
req = self.create_request(mutations=[mutation], commit_now=commit_now)
File "/usr/local/lib/python3.8/dist-packages/pydgraph/txn.py", line 197, in create_request
resp_format = api.Request.RespFormat.JSON
AttributeError: 'EnumTypeWrapper' object has no attribute 'JSON'