Last active
December 18, 2019 15:44
-
-
Save vershimajr/b9eca3b05ec63fc14f1671fc5a9a6ec4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
upload_private_url = 'https://dev.api.temporal.cloud/v2/ipfs/private/file/add' | |
auth_dev_url = 'https://dev.api.temporal.cloud/v2/auth/login' | |
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'] | |
params = {'network_name': network_name, 'hold_time': '1'} | |
files = {'file': open('FILE_PATH','rb')} | |
headers = {'Cache-Control':'no-cache', 'Authorization': 'Bearer '+token} | |
response = requests.post(upload_private_url, headers=headers, data=params, files=files) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment