QR Code Scanner
Overview:
The 'QR Code Scanner' data action block allows you to scan and extract data from one or more QR codes present in your documents. This block is useful for automating the process of reading QR codes and integrating their data into your workflow.
Steps to Set Up the 'QR Code Scanner' Block:
-
Access Your Workflow:
- Navigate to the 'Workflow' section from the left panel on your Nanonets Extract Data page.
-
Add a New Data Action Block:
- Click on “Add a new step” to view the available data action blocks.
- From the list, select "QR Code Scanner".
-
Enter a QR Code Label:
- Provide a label name for the field where the value of the scanned QR code will be stored. This label helps in identifying and accessing the extracted QR code data later in the workflow.
-
Test the Action:
- Select an uploaded file that contains QR codes and click "Run Test". This allows you to verify that the block correctly scans and extracts data from the QR codes as expected.
-
Complete Setup:
- After confirming that the configuration and test results meet your requirements, click "Done" to save and apply the action.
You can apply this data action conditionally, using the Conditional Block.
Handling JWT Tokens from Scanned QR Codes:
When a scanned QR code returns a JWT (JSON Web Token), you can use Python Block to decode and verify the token. Below is a sample Python code snippet to help you handle JWT tokens extracted from QR codes:
import jwt
import json
def handler(token):
try:
# Decode the JWT without verifying the signature
decoded_token = jwt.decode(token, options={"verify_signature": False})
# Get the 'data' field from the decoded token
data_str = decoded_token.get('data')
# Convert the 'data' field from JSON string to dictionary
data_dict = json.loads(data_str)
return json.dumps(data_dict, indent=4)
except Exception as e:
return str(e)
If you don't see this block in your model, please contact us at [email protected].
Updated 23 days ago