Changeset 82 for openweather/update.py
- Timestamp:
- 04/01/07 03:04:57 (5 years ago)
- File:
-
- 1 edited
-
openweather/update.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
openweather/update.py
r80 r82 1 1 #!/usr/bin/env python 2 2 3 DRUPAL_URL='http:// localhost/~nigel/drupal47/xmlrpc.php'3 DRUPAL_URL='http://192.168.1.50/~nigel/drupal47/xmlrpc.php' 4 4 DRUPAL_USERNAME='nigel' 5 5 DRUPAL_PASSWORD='trustno1' … … 12 12 13 13 import xmlrpclib 14 import MySQLdb 14 15 15 16 s = xmlrpclib.ServerProxy(DRUPAL_URL) 16 17 17 print s.openweather.addEntry(DRUPAL_STATIONID, DRUPAL_USERNAME, DRUPAL_PASSWORD) 18 conn = MySQLdb.connect(host=DB_HOST, user=DB_USERNAME, passwd=DB_PASSWORD, db=DB_NAME) 19 cur = conn.cursor(MySQLdb.cursors.DictCursor) 20 # Select the newest record 21 if cur.execute("SELECT * FROM `weather` ORDER BY `timestamp` DESC LIMIT 1;") == 1: 22 row = cur.fetchone() 23 # convert all elements to strings 24 for i in row: 25 row[i] = str(row[i]) 18 26 27 print s.openweather.addEntry(DRUPAL_STATIONID, DRUPAL_USERNAME, DRUPAL_PASSWORD, row) 28 29 cur.close() 30 conn.close() 31
Note: See TracChangeset
for help on using the changeset viewer.
