How to draw a line with matplotlib?

I cannot find a way to draw an arbitrary line with matplotlib Python library. It allows to draw horizontal and vertical lines (with matplotlib.pyplot.axhline and matplotlib.pyplot.axvline, for example), but i do not see how to draw a line through two given points (x1, y1) and (x2, y2). Is there a way? Is there a simple way?

How can I send an xml body using requests library?

def request(): #encoded_xml = urllib.urlencode({'XML': read_xml()}) #encoded_xml = read_xml() headers = {'Authorization': AUTH_TOKEN, 'developerToken': DEVELOPER_TOKEN, 'clientCostumerID': CLIENT_ID} content = {'__rdxml': encoded_xml} #content = encoded_xml #content = {'__rdxml': read_xml2()} r = requests.post(URL, data=content, headers=headers) return r These combinations don’t seem to work. The headers are not set for some reason. Answers: Thank you for visiting the … Read more

Asyncio.gather vs asyncio.wait

asyncio.gather and asyncio.wait seem to have similar uses: I have a bunch of async things that I want to execute/wait for (not necessarily waiting for one to finish before the next one starts). They use a different syntax, and differ in some details, but it seems very un-pythonic to me to have 2 functions that have such a huge overlap in functionality. What am I missing?

Python Comet Server

I am building a web application that has a real-time feed (similar to Facebook’s newsfeed) that I want to update via a long-polling mechanism. I understand that with Python, my choices are pretty much to either use Stackless (building from their Comet wsgi example) or Cometd + Twisted. Unfortunately there is very little documentation regarding these options and I cannot find good information online about production scale users of comet on Python.