小编Ste*_*e-O的帖子

如何使用 Box API 和 Python 下载文件

我目前有我的代码的上传部分工作,我将如何将其转换为将从 box 文件夹中下载相应文件的程序?

这是上传程序:

import requests
import json

#the user acces token
access_token =  'UfUNeHhv4gIxFCn5WEXHgBJwfG8gHT2o'
#the name of the file as you want it to appear in box
dst_filename = 'box_file'
#the actual file path
src_directory = 'C:\Python\cache\\'
#the name of the file to be transferred
src_filename = 'Wildlife.wmv'
#the id of the folder you want to upload to
parent_id = '0'
counter = 1

for counter in range(1, 6):
  src_file = (src_directory + src_filename + '-' + str(counter))
  print(src_file) …
Run Code Online (Sandbox Code Playgroud)

python python-3.x box-api boxapiv2

9
推荐指数
3
解决办法
2万
查看次数

托尔·斯特姆(Tor Stem)-与俄罗斯建立爱恋关系

我正在尝试从Stem项目中获取To Love With Toto乐队

from io import StringIO
import socket
import urllib3
import time

import socks  # SocksiPy module
import stem.process

from stem.util import term

SOCKS_PORT = 9150

# Set socks proxy and wrap the urllib module

socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', SOCKS_PORT)
socket.socket = socks.socksocket

# Perform DNS resolution through the socket

def getaddrinfo(*args):
  return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]

socket.getaddrinfo = getaddrinfo


def query(url):
  """
  Uses urllib to fetch a site using SocksiPy for Tor over the SOCKS_PORT. …
Run Code Online (Sandbox Code Playgroud)

python tor python-3.x stem

5
推荐指数
1
解决办法
1353
查看次数

使用Box.com SDK for Python

我正在尝试开始使用Box.com SDK,我有几个问题.

from boxsdk import OAuth2

oauth = OAuth2(
    client_id='YOUR_CLIENT_ID',
    client_secret='YOUR_CLIENT_SECRET',
    store_tokens=your_store_tokens_callback_method,
)

auth_url, csrf_token = oauth.get_authorization_url('http://YOUR_REDIRECT_URL')

def store_tokens(access_token, refresh_token):
    # store the tokens at secure storage (e.g. Keychain)
Run Code Online (Sandbox Code Playgroud)

1)什么是重定向网址以及如何使用它?我是否需要运行服务器才能使用它?

2)我在store_tokens方法中需要什么样的代码?

python python-3.x box-api boxapiv2

5
推荐指数
2
解决办法
5435
查看次数

标签 统计

python ×3

python-3.x ×3

box-api ×2

boxapiv2 ×2

stem ×1

tor ×1