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
/** | |
* Djur is a thing that can be hungrig. By doing mumsa a Djur can become | |
* !hungrig. | |
*/ | |
public class Djur { | |
private boolean hungrig = true; | |
public boolean isHungrig() { | |
return this.hungrig; | |
} |
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 | |
>>> data = {'user_id': 7, 'name': 'Burny Shawrk', 'email': 'burny@example.com'} | |
>>> requests.post('http://my.service/users', json=data, timeout=5) | |
Traceback (most recent call last): | |
… | |
requests.exceptions.ConnectTimeout: bla bla bla |
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
from bottle import route, run | |
from mako.template import Template | |
import requests | |
template = Template(''' | |
<dl> | |
<dd>Name</dd> | |
<dt>${merchant['name']}</dt> | |
<dd>Number of bills</dd> |
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
''' Responsible for querying remote services and validating the result. ''' | |
from simplejson import JSONDecodeError | |
import requests | |
# Exceptions | |
class ValidationError(Exception): pass | |
class RequestError(Exception): pass | |
# Types for representing results from backend services. |