Skip to content

Conversation

wispyiwnl
Copy link

Description

This PR updates the Python code example in User Flows > Accounts > Account Registration > 3. Obtain a registration nonce section of the documentation.

Problem

The current code example:

  • Lacks necessary imports, such as requests and json
  • Does not print or return the nonce, which is the expected output of this step

Fix

I replaced the current code snippet with a working and cleaner version:

import requests

BASE_URL = "https://testnet-api.orderly.org"

res = requests.get(f"{BASE_URL}/v1/registration_nonce")
print(res.text)

This version:

  • Adds the required import for requests
  • Uses f-string formatting for better readability
  • Includes a print() so users can immediately see the nonce value returned by the endpoint

Let me know if you'd like me to also include json.loads() to parse the response and print just the nonce key.

Copy link
Contributor

@wuzhong-orderly wuzhong-orderly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there
For now this PR doesn’t seem fully align with the overall design of the documentation for the following reasons:

  1. The sample code is intended to demonstrate how to retrieve the account nonce from the endpoint, as part of the overall registration flow. In this context, extracting the value directly provides clearer intent than printing the full response text.
  2. The import statements were intentionally omitted for consistency and simplicity across all code snippets. That said, your point is valid and definitely appreciated.

Nonetheless, thanks for your contribution. We truly value your contribution and look forward to your future feedbacks!

@wispyiwnl
Copy link
Author

Hi! Thanks for your feedback — I’ve updated the snippet to extract and print only the registration_nonce, as suggested.

Let me know if there's anything else to improve. Thanks again for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants