Ipynb idioms: Difference between revisions

From DISI
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:
  format = 'txt'
  format = 'txt'


== execute a command, with optional limits ==
R = requests.get(cmd + '?count=10000')
lines = list(R.iter_lines())
print len(lines)
print R.text


[[Category:webapi]]
[[Category:webapi]]
[[Category:ZINC]]
[[Category:ZINC]]
[[Category:Idioms]]
[[Category:Idioms]]

Revision as of 17:03, 23 October 2014

These are idioms for iPython Notebooks, also generally python.


top of every ipynb

%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import requests
import urllib

set up variables for webapi

(hint ask john for credentials)

urlroot = 'http://x.ucsf.bkslab.org:y'
format = 'txt'

execute a command, with optional limits

R = requests.get(cmd + '?count=10000')
lines = list(R.iter_lines())
print len(lines)
print R.text