Skip to content

Instantly share code, notes, and snippets.

@vershimajr
Last active December 18, 2019 15:44
Show Gist options
  • Save vershimajr/b9eca3b05ec63fc14f1671fc5a9a6ec4 to your computer and use it in GitHub Desktop.
Save vershimajr/b9eca3b05ec63fc14f1671fc5a9a6ec4 to your computer and use it in GitHub Desktop.
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