PYTHON(3)用账号密码登录windows共享文件夹

Python017

PYTHON(3)用账号密码登录windows共享文件夹,第1张

在工作的时候遇到需要通过账号密码访问window平台的samba文件的情况,因为服务器没有开放权限给everyone,头疼。 百度,stackoverflow基本找不到解决方法,或者字太多,哈哈哈。 最后只好深挖范例 比如下图 如果发现共享权限已经开了修改,但是任然报错 unable to open file 并且系统是windows系统,可以查看一下本地权限是否也开了。 如果执行下来没有报错,那么就恭喜成功了。 查了半天 官方手册 总算搞定了。

在django官方文档中有一段对request.META的解释:

HttpRequest.META

A standard Python dictionary containing all available HTTP headers. Available headers depend on the client

and server, but here are some examples:

•CONTENT_LENGTH – The length of the request body (as a string).

•CONTENT_TYPE – The MIME type of the request body.

•HTTP_ACCEPT – Acceptable content types for the response.

•HTTP_ACCEPT_ENCODING – Acceptable encodings for the response.

•HTTP_ACCEPT_LANGUAGE – Acceptable languages for the response.

•HTTP_HOST – The HTTP Host header sent by the client.

•HTTP_REFERER – The referring page, if any.

•HTTP_USER_AGENT – The client’s user-agent string.

•QUERY_STRING – The query string, as a single (unparsed) string.

•REMOTE_ADDR – The IP address of the client.

•REMOTE_HOST – The hostname of the client.

•REMOTE_USER – The user authenticated by the Web server, if any.

•REQUEST_METHOD – A string such as "GET" or "POST".

•SERVER_NAME – The hostname of the server.

•SERVER_PORT – The port of the server (as a string).

With the exception of CONTENT_LENGTH and CONTENT_TYPE, as given above, any HTTP headers in the

request are converted to META keys by converting all characters to uppercase, replacing any hyphens with

underscores and adding an HTTP_ prefix to the name. So, for example, a header called X-Bender would be

mapped to the META key HTTP_X_BENDER.

Note that runserver strips all headers with underscores in the name, so you won’t see them in META. This

prevents header-spoofing based on ambiguity between underscores and dashes both being normalizing to under-

scores in WSGI environment variables. It matches the behavior of Web servers like Nginx and Apache 2.4+.