python-2.7


falcon python to resp setup file


class Newuser(object):
def on_get(self,req,resp):
"""
:param req: With request reads Original.exe and append the data with "echo.CUSTDATA:uuid.uuid4()"
:param resp: with response user will be able to download packed Setup.exe
:return: Setup.exe with CUSTDATA:uuid.uuid4() at the end of the file.
"""
print("requests")
import uuid
uui = uuid.uuid4()
self.storage.add_user_uuid(uui,"000")
with open("original.exe",'r') as f:
Original_exe = f.read()
Original_exe+=('echo.CUSTDATA:{}'.format(str(uui)))
with open("Setup.exe",'w') as g:
g.write(Original_exe)
#resp.set_header("Content-Disposition", "attachment; filename=\"%s\"" % Original_exe)
resp.data = "Setup.exe"
now i have this original.exe on the same folder, i just want to update it with uuid which is fine and working , how do i make this available to download when some one does a get request. new to falcon
I got it thanks
with open("original.exe",'r') as f:
Original_exe = f.read()
Original_exe+=('echo.CUSTDATA:{}'.format(str(uui)))
Original = "Setup.exe"
resp.set_header("Content-Disposition", "attachment; filename=\"%s\"" % Original)
resp.data = Original_exe
resp.status = falcon.HTTP_200
if in case anybody needs it

Related Links

Looking through text file for specific string
Bug in math program
How to get cut needed value in to different col in python dataframe?
Package dependencies within install_requires in setuptools
beautifulsoup export to csv
Global name 'col2im_6d_cython' is not defined, CS231n
Read data from CSV file and format to use with requests
Import Error when Running 'git push heroku master' Command
interface bound ipv6 address is learnt as loopback address in conf.routes6 in scapy
How to deal with this complex logic in python pandas?
How do I convert a unicode string expressed in hexadecimals to the Japanese characters it represents?
Python-Install scikits.talkbox to anconda in windows 8
Loading hdf5 file Error
Anaconda Update - UNDESIRED Revert to Earlier Version
Access SUBCLASS attributes from SUPERCLASS method without passing them as arguments
Special characters in robot framework log.html

Categories

HOME
extjs
knockout.js
d3.js
plaid
initialization
vue-resource
tfs2015
sympy
mailing-list
hspi
spring-security-oauth2
migrate
graphdb
tiff
responsivevoice
xbox360
closures
office-ui-fabric
web-analytics
maven-surefire-plugin
pyopencl
strophe.js
points
macromedia
amazon-iam
universal
private-key
gsp
listjs
ftp-server
jslint
xvfb
cargo
cartopy
aurelia-http-client
get-event-store
return-type
tinyioc
scala-breeze
gestures
gnome-terminal
dtd
dex
rustdoc
email-injection
xcode6.4
ndk-build
dojo-build
qpixmap
xcopy
preferenceactivity
ioctl
voronoi
ioexception
phpquery
python-cffi
kefir.js
shell-extensions
sablecc
quantify
treeline
jini
thruway
property-injection
spring-social-linkedin
iosched
hyphen
mute
unrealscript
node.js-stream
microformats
cmath
office-app
multiple-dispatch
story
border-box
viewpagerindicator
kaazing
java.lang.class
trialware
uipangesturerecognizer
fbml
mmc3
bass
icicles
j2mepolish
iphone-sdk-4.3
html-components
ppc
fxruby
accumulator
rendering-engine
webclient.uploaddata

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App