当前位置: 首页 > news >正文

做网站的收益在哪网站所有者是什么意思

做网站的收益在哪,网站所有者是什么意思,建设游戏运营网站开展工作内容,做网站引流的最佳方法项目需要#xff0c;在mac上将打包好的文件(四五百兆)自动上传到web后台#xff0c;用了两种方式上传#xff0c;都报了类似的错误#xff0c;在windows和linux上测试不会报错#xff0c;但是到了mac打包机上就会报错#xff1a;①第一种报错#xff1a;Traceback (most…项目需要在mac上将打包好的文件(四五百兆)自动上传到web后台用了两种方式上传都报了类似的错误在windows和linux上测试不会报错但是到了mac打包机上就会报错①第一种报错Traceback (most recent call last):File my_upload.py, line 61, in moduleupload_pack(f)File my_upload.py, line 54, in upload_packr requests.post(url, form, filesfiles)File /Library/Python/2.7/site-packages/requests-2.9.1-py2.7.egg/requests/api.py, line 107, in postreturn request(post, url, datadata, jsonjson, **kwargs)File /Library/Python/2.7/site-packages/requests-2.9.1-py2.7.egg/requests/api.py, line 53, in requestreturn session.request(methodmethod, urlurl, **kwargs)File /Library/Python/2.7/site-packages/requests-2.9.1-py2.7.egg/requests/sessions.py, line 468, in requestresp self.send(prep, **send_kwargs)File /Library/Python/2.7/site-packages/requests-2.9.1-py2.7.egg/requests/sessions.py, line 576, in sendr adapter.send(request, **kwargs)File /Library/Python/2.7/site-packages/requests-2.9.1-py2.7.egg/requests/adapters.py, line 426, in sendraise ConnectionError(err, requestrequest)requests.exceptions.ConnectionError: (Connection aborted., error(32, Broken pipe))代码# -*- coding: UTF-8 -*-import requestsimport jsonimport sysreload(sys)sys.setdefaultencoding(utf-8)url http://10.242.12.121:9096/auto_upload/# configchannel unicode(test2).encode(utf-8)form {platform: Android, channel: channel, publish_time: 2016-08-01 00:00, remarks: auto_test, code: HH}files {file: (D3174449.apk, open(D3174449.apk, rb), application/octet-stream)}print upload...s requests.session()r s.post(url, form, filesfiles, timeout500)print r.text# print unicode(json.loads(r.text)).encode(utf-8)print upload_end第二种报错urllib2.URLError: 代码#!/usr/bin/python# -*- coding: utf-8 -*-import sysreload(sys)sys.setdefaultencoding(utf-8)# buld post body dataimport urllib2import timeboundary ----WebKitFormBoundary3hYfNZFUuz8yiMiddata []data.append(--%s % boundary)data.append(Content-Disposition: form-data; name%s\r\n % platform)data.append(Android)data.append(--%s % boundary)data.append(Content-Disposition: form-data; name%s\r\n % channel)data.append(360)data.append(--%s % boundary)data.append(Content-Disposition: form-data; name%s\r\n % publish_time)data.append(2016-08-23 00:00)data.append(--%s % boundary)data.append(Content-Disposition: form-data; name%s\r\n % remarks)data.append(hh2)data.append(--%s % boundary)data.append(Content-Disposition: form-data; name%s\r\n % code)data.append(HH)data.append(--%s % boundary)fr open(u./D3174449.apk, rb)data.append(Content-Disposition: form-data; name%s; filenameD3174449.apk % file)data.append(Content-Type: %s\r\n % application/octet-stream)data.append(fr.read())fr.close()data.append(--%s--\r\n % boundary)http_url http://10.242.12.121:9096/auto_upload/http_body \r\n.join(data)print upload...try:# buld http requestreq urllib2.Request(http_url, datahttp_body)# header#req.add_header(Content-Type, multipart/form-data; boundary%s % boundary)#req.add_header(User-Agent, Mozilla/5.0)#req.add_header(Referer, http://10.246.13.129:9099/auto_upload/)req.add_header(Accept, application/json, text/javascript, */*; q0.01)req.add_header(Accept-Encoding, gzip, deflate)req.add_header(Accept-Language, zh-CN,zh;q0.8)req.add_header(Connection, keep-alive)#req.add_header(Content-Length, 620)req.add_header(Content-Type, multipart/form-data; boundary%s % boundary)req.add_header(Cookie, session.eJyrVkosLclQsjLUUUrOT0lVsqpWUkhSslIKdgmsUqoFCRYVALkZGXkmBhYGSjpKqbmJmTkIEQeQAr281JLUxOJUveT8XKCStNKcnLzEXKBhSjGlFgaphjGlZilmlkq1AP-KIUg.Cp7ldw.cDtv8It9wXz12qb7JbI5gf08rew)req.add_header(Origin, http://10.246.13.129:9096)req.add_header(Referer, http://10.246.13.129:9096/auto_upload/)req.add_header(User-Agent, Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36)req.add_header(X-Requested-With, XMLHttpRequest)# post data to serverresp urllib2.urlopen(req, timeout500)# get responseqrcont resp.read()print qrcontexcept Exception, e:print eprint upload end搜索能力有限去谷歌搜了下没有找到合适的解决办法或者是理解不够https://github.com/kennethrei…服务端代码def auto_upload():上传文件try:file request.files[file]except:print file failprint myautofile_debug, fileplatform request.form.get(platform)channel request.form.get(channel)publish_time request.form.get(publish_time)remarks request.form.get(remarks)code request.form.get(code)#create channel if channel does not existdata {platform: platform, channel: channel, remarks: , app_num: 0, code: code}result app.config[mongo].insert_channel_data(data)print result:, result#if result is not False:# 增加渠道目录platform_dir os.path.join(app.config[UPLOAD_FOLDER], code, platform)channel_dir os.path.join(platform_dir, channel)print add_channel, platform_dir, channel_dir, os.path.exists(platform_dir), os.path.exists(channel_dir)#try:if not os.path.exists(platform_dir):os.mkdir(platform_dir)if not os.path.exists(channel_dir):os.mkdir(channel_dir)#except:#return Response(json.dumps(fail), mimetypeapplication/json)# channel channel.encode(utf-8)relative_path code os.sep platform os.sep channel os.sep#print upload_file, relative_pathif file:# filename secure_filename(file.filename)filename file.filenamefilename gen_file_name(filename, relative_path)mimetype file.content_type#print auto_mimetype:, mimetypeif not allowed_file(file.filename, platform):#print not allowedresult uploadfile(namefilename, typemimetype, size0, not_allowed_msg文件类型错误)else:# save file to diskuploaded_file_path os.path.join(app.config[UPLOAD_FOLDER], relative_path filename)file.save(uploaded_file_path)# get file size after savingsize os.path.getsize(uploaded_file_path)size_str _formatFileSize(size)#print size, size, size_str# save data into databasedata {}data[code] codedata[platform] platformdata[channel] channeldata[filename] filenamedata[url] uploaded_file_pathdata[size] size_strdata[publish_time] publish_timedata[upload_time] datetime.now().strftime(%Y-%m-%d %H:%M:%S)data[remarks] remarksapp.config[mongo].insert_app_data(data)# return json for js call backresult uploadfile(namefilename, typemimetype, sizesize, relative_path relative_path)return json.dumps({files: [result.get_file()]})你这个一般都需要结合服务器端的软件代码、框架版本之类的来解决啊不过既然你特意说了Windows、Linux和MAC的差异我只知道一个比较重要的差异就是MAC操作系统在对方shutdown的情况下不能保持半连接状态一段时间后悔自动关闭所以如果你的服务器端在还没有传输完文件的情况下就以某种方式SHUTDOWN了写的一端就会在传输中出错比如说先发送了返回值再慢慢接收数据。没有别的信息的话只能先这么猜了。
http://wiki.neutronadmin.com/news/254561/

相关文章:

  • 福州建设人才网站房子装修设计图片大全
  • 网上书城网站开发环境江西省做网站
  • 台州哪家做企业网站比较好wordpress新框架vue
  • wiz wordpressphp网站开发优化
  • 如何在阿里巴巴建设网站网站引导视频怎么做
  • 只做早餐的网站网站备案最多需要多久
  • 门户网站维护方案百度浏览器网址大全
  • 网站核验单dw个人网页制作模板源代码
  • 网站建站的标准久久建筑网登录入口
  • 网站安全检测网站赚钱软件app
  • 谁家网站做的好mssql网站开发
  • 临海建设银行网站网站建设政务新媒体
  • 优秀网站设计 打造有吸引力的网站wordpress页面显示分类目录
  • 西安网站建设l西安搜推宝网络wordpress会员充值管理系统
  • 做网站引用没有版权的歌曲网站建设集团
  • 如何选择网站改版公司易语言网站做软件
  • 怎么查看网站是否备案手机靓号网站制作
  • wap网站 劣势网站总是跳转dede58
  • 建设信用卡银行积分兑换商城网站建设部执业资格网站
  • h5网站有哪些可以查授权的网站怎么做
  • 做网站的图片=gif私密浏览器有哪些
  • 怎样做网站ppt深圳网络做网站
  • 做商品网站宿州市网站建设有哪些公司
  • 东明菏泽网站建设网站免费下载安装
  • 番禺网站建设三杰科技安徽网络seo
  • 郑州北环网站建设培训vi设计公司
  • 做的好的企业网站广州公司网页制作
  • 深圳网站建设叶林wordpress魔方
  • 免费下载建筑图纸的网站EDI许可证需要的网站怎么做
  • 强的网站建设公google play store