Changeset - 47d07b5cb8db
[Not reviewed]
Dennis Fink - 9 years ago 2016-03-02 20:01:22
dennis.fink@c3l.lu
Added flags
3 files changed with 20 insertions and 0 deletions:
0 comments (0 inline, 0 general)
ennstatus/api/model.py
Show inline comments
 
@@ -120,6 +120,7 @@ class Server:
 
        self.last_updated = kwargs['last_updated']
 
        self.country = kwargs['country']
 
        self.bandwidth = kwargs.get('bandwidth')
 
        self.flags = kwargs.get('flags')
 

	
 
        if self.type == 'bridge':
 
            self.obfs = kwargs.get('obfs')
 
@@ -247,6 +248,15 @@ class Server:
 
            data.consensus_weight_fraction
 
        )
 

	
 
    def update_flags(self):
 

	
 
        try:
 
            data = manager.query('details', lookup=self.fingerprint)
 
        except:
 
            raise NotImplementedError
 

	
 
        self.flags = data.relays[0].flags
 

	
 
    def check_status(self):
 

	
 
        now = datetime.utcnow()
ennstatus/api/schema/server.json
Show inline comments
 
@@ -100,6 +100,11 @@
 
        },
 
        "type": {
 
            "type": "string"
 
        },
 
        "flags": {
 
            "type": "array",
 
            "items": { "type": "string" },
 
            "uniqueItems": true
 
        }
 
    },
 
    "required": [
ennstatus/api/views.py
Show inline comments
 
@@ -121,6 +121,11 @@ def update():
 
        pass
 

	
 
    try:
 
        server.update_flags()
 
    except NotImplementedError:
 
        pass
 

	
 
    try:
 
        server.save()
 
    except Exception as e:
 
        current_app.logger.error(str(e))
0 comments (0 inline, 0 general)