Skip to content

Instantly share code, notes, and snippets.

@Cabalist
Created November 20, 2011 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cabalist/1380718 to your computer and use it in GitHub Desktop.
Save Cabalist/1380718 to your computer and use it in GitHub Desktop.
Python LS request
import requests # http://python-requests.org
headers = {'User-Agent': "public.ID.here/1.0", 'X-PAPPID': "private-id-goes-here"}
r = requests.get('https://localhost:9630/api/invoices/', headers=headers, auth=("USERNAME", "PASSWORD"))
from BeautifulSoup import BeautifulStoneSoup as BSS
soup = BSS(r.content)
invoices = []
for x in soup.findAll('invoice'):
invoices.append(dict((t.name, t.text) for t in x.findAll(True)))
for i in invoices:
print i[u'invoice_id'] + ":" + "Retrieved"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment