Josh VanderLinden avatar Josh VanderLinden committed f10df8f

Trying to get the desktop repo back in sync

Comments (0)

Files changed (4)

clip2zeus/__init__.py

 APP_TITLE = 'Clip2Zeus'
 __author__ = 'Josh VanderLinden'
-__version__ = '1.2a'
+__version__ = '1.3a'
 

clip2zeus/common.py

 
         if self.last_check is None or now - self.last_check > self.threshold:
             try:
-                urllib2.urlopen('http://2ze.us/')
+                UrlOpener.open('http://2ze.us/')
             except (urllib2.HTTPError, urllib2.URLError):
                 self._has_connection = False
             else:
 
                 try:
                     logger.info(' - %s' % url)
-                    c = urllib2.urlopen('http://2ze.us/generate/', params)
+                    c = UrlOpener.open('http://2ze.us/generate/', params)
                 except (urllib2.HTTPError, urllib2.URLError):
                     # do something?
                     update_data = False

clip2zeus/globals.py

 from SimpleXMLRPCServer import SimpleXMLRPCServer
 import logging
 import socket
+import urllib2
+
+from clip2zeus import __version__
+
+USER_AGENT = 'Clip2Zeus %s' % __version__
+
+UrlOpener = urllib2.build_opener()
+UrlOpener.addheaders = [
+    ('User-agent', USER_AGENT),
+]
 
 #
 # Utilities
     **extra
 )
 
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.