Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwhitman committed Jun 17, 2024
1 parent 6e836e1 commit 33259eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
3 changes: 2 additions & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ There are two ways of getting files between Tulip hardware and your computer:

- **Use Tulip World and Tulip Desktop:** On [Tulip Desktop](tulip_desktop.md) your files are in your home folder + `tulipcc/user`. (On the Mac, under ~/Documents/tulipcc/user.) You can edit and add files there directly and use `world.upload(folder)` or `world.upload(filename)` to place files on Tulip World from either Deskop or hardware Tulip. You can retrieve these files with `world.download(folder)` or `world.download(filename)`. The only downside to this method is that your files are publicly available to anyone else on Tulip World, so please don't share private information using Tulip World.

- **Use our file transfer script**: On your computer, run the Python script [file_server.py](../tulip/shared/util/file_server.py) like `$ python file_server.py`. Wherever you run that script, all files in the folder you ran it from will be available to your Tulip. You can transfer any files **from** a computer to Tulip with `tulip.url_save(url, filename)` like: `tulip.url_save('http://192.168.1.23:8000/file.py`, 'file.py'). To transfer from a Tulip **to** a computer, use `tulip.url_put(url, file)` like `tulip.url_put('http://192.168.1.23:8000', 'file.py')` and it will appear in that folder on your computer. Use your computers' network manager to find out the IP address (the `192.168.1.23` bit.) This method is private, you are only transferring data over the local network. Maybe someone can contribute a more full featured Tulip transfer system one day!
- **Use our file transfer script**: On your computer, run the Python script [file_server.py](../tulip/shared/util/file_server.py) like `$ python file_server.py`. Wherever you run that script, all files in the folder you ran it from will be available to your Tulip. You can transfer any files **from** a computer to Tulip with `tulip.url_save(url, filename)` like: `tulip.url_save('http://192.168.1.23:8000/file.py', 'file.py')`. The `file.py` should be a file in the current directory that you've run `file_server.py` from.\
To transfer from a Tulip **to** a computer, use `tulip.url_put(url, file)` like `tulip.url_put('http://192.168.1.23:8000', 'file.py')` and it will appear in that folder on your computer. Use your computers' network manager to find out the IP address (the `192.168.1.23` bit.) This method is private, you are only transferring data over the local network. Maybe someone can contribute a more full featured Tulip transfer system one day!



Expand Down
12 changes: 0 additions & 12 deletions tulip/shared/util/file_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@
import SimpleHTTPServer as server

class HTTPRequestHandler(server.SimpleHTTPRequestHandler):
"""Extend SimpleHTTPRequestHandler to handle PUT requests"""
def do_PUTX(self):
"""Save a file following a HTTP PUT request"""
filename = self.headers['Tulip-Filename']
file_length = int(self.headers['Content-Length'])
with open(filename, 'wb') as output_file:
output_file.write(self.rfile.read(file_length))
self.send_response(201, 'Created')
self.end_headers()
#reply_body = 'Saved "%s"\n' % filename
#self.wfile.write(reply_body.encode('utf-8'))

def do_PUT(self):
self.send_response(200)
self.end_headers()
Expand Down

0 comments on commit 33259eb

Please sign in to comment.