Here is an example of a simple blockchain in Python: import hashlib import json import random class Block: def __init__(self, timestamp, transactions, previous_hash): self.timestamp = timestamp self.transactions
In Python, a function is defined with the def statement followed by the name of the function. A function can include required and optional arguments, or no arguments at all. Return the output of a function using the return statement. Time You can use the Code Block parameter ...
fixture def selenium(selenium): selenium.implicitly_wait(30) selenium.maximize_window() return selenium def test_one(selenium): try: selenium.get("http://www.python.org") assert "Python" in selenium.title elem = selenium.find_element_by_name("q") elem.send_keys("documentation") elem.send...
See the examples folder for a first node example that other nodes can bootstrap connect to and some code that gets and sets a key/value. Logging This library uses the standardPython logging library. To see debut output printed to STDOUT, for instance, use: ...
import json import requests def handler (event, context): token = context.getToken() project_id = context.getProjectID() urn = 'urn:fss:xx-xxxxx-x:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:function:xxx:subfunction:latest' # Subfunction URN, which can be queried on the right of the topology on ...
All DDL (Data Definition Language) statements are executed using a handle structure known as a cursor. The following examples show how to create the tables of the Employee Sample Database. You need them for the other examples. In a MySQL server, tables are very long-lived objects, and are...
def handle_indicator_response( addon: Any, request_id: int, indicator_id: int ) -> None: """ This function is called after you create an indicator, in response to `register_indicator`. :param addon: The addon state object that you received when calling `create_addon`. :param request_...
, the administrator manages the router through a remote network and can upload a Python script to the router. Changes of important routes need to be monitored so that logs can be generated to communicate the changes of routes to users in a timely manner....
import ops import sys import re def ops_condition (o): print("It enters ops_condition") #configure eth condition to execute the ops script; status, err_str = o.interface.ifstat_subscribe("interface1", 1, "GigabitEthernet0/0/0", 2) return status def ops_execute (o): handle, err_des...
This tutorial shows how to connect a device to AWS IoT Core by using Python code examples, which require a relatively powerful device. If you are working with resource-constrained devices, these code examples might not work on them. In that case, you might have more success with theTutorial...