def add_code(self, client_id, user_id, lifetime):
        
        user_id = ObjectId(user_id)
        expires = add_seconds_to_date(datetime.datetime.now(), lifetime)

        # do -> while FTW
        code = OAuthStorage.generate_hash_sha1()
        while self.get_refresh_token(code):
            code = OAuthStorage.generate_hash_sha1()

        self.db.codes.save({'_id': code,
                            'client_id': client_id,
                            'user_id': user_id,
                            'expires': expires})

        return code
Creates and sends a request to the given url
dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/MongoStorage.add_code--crossover with--dataset/ETHPy150Open matrix-org/synapse/contrib/cmdclient/http.py/TwistedHttpClient._create_request