def get_data(queue): # Create a client and login client = self.gdata.projecthosting.client.ProjectHostingClient() client.client_login( settings.ERROR_CAPTURE_GOOGLE_CODE_LOGIN, settings.ERROR_CAPTURE_GOOGLE_CODE_PASSWORD, source='error-capture-middleware', service='code', ) # Setup the templates title_tpl = loader.get_template( 'django_error_capture_middleware/googlecode/title.txt') body_tpl = loader.get_template( 'django_error_capture_middleware/googlecode/body.txt') # Add the issue result = client.add_issue( settings.ERROR_CAPTURE_GOOGLE_CODE_PROJECT, title_tpl.render(self.context), body_tpl.render(self.context), settings.ERROR_CAPTURE_GOOGLE_CODE_LOGIN, 'open', labels=[settings.ERROR_CAPTURE_GOOGLE_CODE_TYPE]) # pull the data we want out and throw it in the queue issue_url = result.find_html_link() id = issue_url.split('=')[-1] queue.put_nowait([id, issue_url])
def all(self): """Retrieve all the issues in a project.""" #data = memcache.get("issues_all") #if data is not None: # return data, True client = gdata.projecthosting.client.ProjectHostingClient() client.client_login( conf.USER_NAME, conf.USER_PASS, source='flightgear-bot', service='code') feed = client.get_issues(conf.GOOGLE_PROJECT) data = [] print sfeed for issue in feed.entry: dic = process_entry(issue) data.append(dic) if not memcache.set("issues_all", data, 60): print "error" return data
def authenticating_client(self, client, username, password): return client.client_login(username, password, source='your-client-name', service='code')
# replace this URL with a recent JIRA search for all of the tickets # you want to migrate URL = "http://jira.openqa.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?&pid=10030&pid=10190&pid=10160&pid=10070&pid=10121&pid=10100&resolution=-1&sorter/field=updated&sorter/order=DESC&tempMax=1000" if os.path.isfile("sejira.json"): data = json.load(open("sejira.json", "rb")) else: resp = urllib2.urlopen(URL).read() data = xmlbegone.loads(resp) open("sejira.json", "wb").write(json.dumps(data)) client = gdata.projecthosting.client.ProjectHostingClient() client.client_login( USERNAME, PASSWORD, source='dejirate', service='code') project = 'jira-to-google-code' def html2text(html): li_re = re.compile(r'<li[^>]*>') html = li_re.sub('* ', html) for tag in ['br', 'p', 'ul', 'ol', 'li', 'div', 'span']: tag_re = re.compile(r'</?%s[^>]*>' % tag) html = tag_re.sub('', html) return html print len(data['rss']['channel']['item']) for i, item in enumerate(data['rss']['channel']['item']):
def authenticating_client(self, client, username, password): return client.client_login(username, password, source="your-client-name", service="code")