-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strings must be encoded before hashing #181
Comments
What’s your python version?On Aug 6, 2023, at 4:39 PM, Martynas Jusevičius ***@***.***> wrote:
Just installed awscurl on EC2 (Ubuntu) and trying to access the Neptune DB endpoint, but
awscurl 'https://xxxxxxxxxxxcluster.cluster-ro-cnol6sn9sq5j.us-east-1.neptune.amazonaws.com:8182/sparql' \
-X POST \
--data-binary \
-d 'query=ASK {}' \
--region us-east-1 \
--service neptune-db
this gives me an error:
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/awscurl", line 8, in <module>
sys.exit(main())
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/awscurl.py", line 543, in main
inner_main(sys.argv[1:])
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/awscurl.py", line 516, in inner_main
response = make_request(args.request,
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/awscurl.py", line 107, in make_request
canonical_request, payload_hash, signed_headers = task_1_create_a_canonical_request(
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/awscurl.py", line 219, in task_1_create_a_canonical_request
payload_hash = sha256_hash_for_binary_data(data) if data_binary else sha256_hash(data)
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/utils.py", line 20, in sha256_hash_for_binary_data
return hashlib.sha256(val).hexdigest()
TypeError: Strings must be encoded before hashing
Am I missing something? :)
Also, is intentional that the --data-binary option does not take an argument? Because it does in plain curl.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
$ python3 --version
Python 3.10.12 |
Interesting Btw, why are using binary, your example has a readable string (in the -d parameter)?On Aug 6, 2023, at 4:39 PM, Martynas Jusevičius ***@***.***> wrote:
Just installed awscurl on EC2 (Ubuntu) and trying to access the Neptune DB endpoint, but
awscurl 'https://xxxxxxxxxxxcluster.cluster-ro-cnol6sn9sq5j.us-east-1.neptune.amazonaws.com:8182/sparql' \
-X POST \
--data-binary \
-d 'query=ASK {}' \
--region us-east-1 \
--service neptune-db
this gives me an error:
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/awscurl", line 8, in <module>
sys.exit(main())
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/awscurl.py", line 543, in main
inner_main(sys.argv[1:])
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/awscurl.py", line 516, in inner_main
response = make_request(args.request,
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/awscurl.py", line 107, in make_request
canonical_request, payload_hash, signed_headers = task_1_create_a_canonical_request(
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/awscurl.py", line 219, in task_1_create_a_canonical_request
payload_hash = sha256_hash_for_binary_data(data) if data_binary else sha256_hash(data)
File "/home/ubuntu/.local/lib/python3.10/site-packages/awscurl/utils.py", line 20, in sha256_hash_for_binary_data
return hashlib.sha256(val).hexdigest()
TypeError: Strings must be encoded before hashing
Am I missing something? :)
Also, is intentional that the --data-binary option does not take an argument? Because it does in plain curl.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
I was just following the examples from Using RDF and SPARQL to access the graph in Amazon Neptune and replacing If I remove the awscurl 'https://octopustriplestorecluster.cluster-ro-cnol6sn9sq5j.us-east-1.neptune.amazonaws.com:8182/sparql' \
-X POST \
-d 'query=ASK {}' \
--region us-east-1 \
--service neptune-db I get a Neptune error:
|
Hmm, I’d have to try that. Meantime could you check if this is your issue, and see if workaround in the end works for you:How to escape AMP query parameter right? · Issue #169 · okigan/awscurlgithub.comOn Aug 6, 2023, at 5:08 PM, Martynas Jusevičius ***@***.***> wrote:
I was just following the examples from Using RDF and SPARQL to access the graph in Amazon Neptune
and replacing curl with awscurl :)
If I remove the --data-binary arg
awscurl 'https://octopustriplestorecluster.cluster-ro-cnol6sn9sq5j.us-east-1.neptune.amazonaws.com:8182/sparql' \
-X POST \
-d 'query=ASK {}' \
--region us-east-1 \
--service neptune-db
I get a Neptune error:
{"requestId":"2ec4e671-f734-5519-03fd-6971f5229051","detailedMessage":"Missing 'query' or 'update' parameter for POST request","code":"MissingParameterException"}
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
This works! awscurl 'https://xxxxxxxxxxxxcluster.cluster-ro-cnol6sn9sq5j.us-east-1.neptune.amazonaws.com:8182/sparql' \
-X POST \
-d 'query=ASK {}' \
--region us-east-1 \
--service neptune-db \
--header 'Content-Type: application/x-www-form-urlencoded' |
@okigan what about |
The following works for me for to send a CONSTRUCT query and requesting response as N-Triples (using URL from your example for consistency):
Note that with query via POST with URL-encoded parameters the content type header of the HTTP request must be set to |
Just installed
awscurl
on EC2 (Ubuntu) and trying to access the Neptune DB endpoint, butthis gives me an error:
Am I missing something? :)
Also, is intentional that the
--data-binary
option does not take an argument? Because it does in plain curl.The text was updated successfully, but these errors were encountered: