File: python_example.py

package info (click to toggle)
obexftp 0.24.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 792 kB
  • sloc: ansic: 7,735; ruby: 229; sh: 89; perl: 43; makefile: 39; python: 16
file content (27 lines) | stat: -rwxr-xr-x 426 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python

import obexftp

obex = obexftp.client(obexftp.BLUETOOTH)

devs = obex.discover();
print devs;
dev = devs[0]
print "Using %s" % dev
channel = obexftp.browsebt(dev,0)
print "Channel %d" % channel

print obex.connect(dev, channel)

print obex.list("/")

print obex.list("/images")

data = obex.get("/images/some.jpg")
file = open('downloaded.jpg', 'wb')
file.write(data)

print obex.disconnect()

obex.delete