Skip to content

Instantly share code, notes, and snippets.

@danlamanna
Created January 24, 2013 20:44
Show Gist options
  • Save danlamanna/4627531 to your computer and use it in GitHub Desktop.
Save danlamanna/4627531 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/python
import requests
import re
import json
from BeautifulSoup import BeautifulSoup
from BeautifulSoup import BeautifulStoneSoup
s = requests.session()
r = s.get("https://burstmarketing.assembla.com/p/home")
soup = BeautifulSoup(r.text)
auth = soup.findAll(attrs={"name" : "authenticity_token"})[0]['value']
payload = { 'user[login]' : username,
'user[password]' : password,
'utf8' : '',
'authenticity_token' : auth,
'protfolio_id' : 'burstmarketing',
'commit' : 'Login' }
r = s.post('https://burstmarketing.assembla.com/do_login', data=payload)
r = s.get('https://burstmarketing.assembla.com/p/projects')
soup = BeautifulSoup(r.text)
ids = [x['data-space-id'] for x in soup.findAll(attrs={"data-space-id" : True} )]
# names = [x.a.text for x in soup.findAll(attrs={ "class" : re.compile("projects-list") })]
# print json.dumps(dict(zip(ids, names)))
root = BeautifulStoneSoup("<?xml version='1.0' encoding='utf-8'?><spaces type='array'></spaces>")
for id in ids:
print id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment