Skip to content

Instantly share code, notes, and snippets.

@vershimajr
Last active December 18, 2019 15:17
Show Gist options
  • Save vershimajr/8a81dbe8a08f4615c858bb38e56bc39c to your computer and use it in GitHub Desktop.
Save vershimajr/8a81dbe8a08f4615c858bb38e56bc39c to your computer and use it in GitHub Desktop.
import json
import requests
auth_dev_url = 'https://dev.api.temporal.cloud/v2/auth/login'
new_net_url = 'https://dev.api.temporal.cloud/v2/ipfs/private/network/new'
start_net_url = 'https://dev.api.temporal.cloud/v2/ipfs/private/network/start'
username = 'USERNAME'
password = 'PASSWORD'
#AUTHING
headers = {'Content-Type':'text/plain',}
credentials = {"username": username, "password": password,}
payload = json.dumps(credentials)
response = requests.post(auth_dev_url,data=payload,headers=headers)
token = response.json()['token']
#CREATE_NETWORK
network_name = 'NETWORK_NAME'
params = {'network_name': network_name}
headers = {'Cache-Control':'no-cache', 'Authorization': 'Bearer '+token}
response = requests.post(new_net_url, headers=headers, data=params)
#START_NETWORK
response = requests.post(start_net_url, headers=headers, data=params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment