Created
November 20, 2011 19:09
-
-
Save Cabalist/1380718 to your computer and use it in GitHub Desktop.
Python LS request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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