Function which receives the data from Perseids

            - Check the branch does not exist
            - Make the branch if needed
            - Receive PUT from Perseids
            - Check if content exist
            - Update/Create content
            - Open Pull Request
            - Return PR link to Perseids

        It can take a "branch" URI parameter for the name of the branch

        :param filename: Path for the file
        :return: JSON Response with status_code 201 if successful.

def r_receive(self, filename):
        """ Function which receives the data from Perseids

            - Check the branch does not exist
            - Make the branch if needed
            - Receive PUT from Perseids
            - Check if content exist
            - Update/Create content
            - Open Pull Request
            - Return PR link to Perseids

        It can take a "branch" URI parameter for the name of the branch

        :param filename: Path for the file
        :return: JSON Response with status_code 201 if successful.
        """
        ###########################################
        # Retrieving data
        ###########################################
        content = request.data.decode("utf-8")
        # Content checking
        if not content:
            error = self.ProxyError(300, "Content is missing")
            return error.response()

        author_name = request.args.get("author_name", self.default_author.name)
        author_email = request.args.get("author_email", self.default_author.email)
        author = Author(author_name, author_email)

        date = request.args.get("date", datetime.datetime.now().date().isoformat())
        logs = request.args.get("logs", "{} updated {}".format(author.name, filename))

        self.logger.info("Receiving query from {}".format(author_name), extra={"IP": request.remote_addr})

        ###########################################
        # Checking data security
        ###########################################
        secure_sha = None
        if "fproxy-secure-hash" in request.headers:
            secure_sha = request.headers["fproxy-secure-hash"]

        if not secure_sha or not self.check_sha(secure_sha, content):
            error = self.ProxyError(300, "Hash does not correspond with content")
            return error.response()

        ###########################################
        # Setting up data
        ###########################################
        file = File(
            path=filename,
            content=content,
            author=author,
            date=date,
            logs=logs
        )
        file.branch = request.args.get("branch", self.default_branch(file))

        ###########################################
        # Ensuring branch exists
        ###########################################
        branch_status = self.get_ref(file.branch)

        if isinstance(branch_status, self.ProxyError):  # If we have an error from github API
            return branch_status.response()
        elif not branch_status:  # If it does not exist
            # We create a branch
            branch_status = self.make_ref(file.branch)
            # If branch creation did not work
            if isinstance(branch_status, self.ProxyError):
                return branch_status.response()

        ###########################################
        # Pushing files
        ###########################################
        # Check if file exists
        # It feeds file.blob parameter, which tells us the sha of the file if it exists
        file = self.get(file)
        if isinstance(file, self.ProxyError):  # If we have an error from github API
            return file.response()

        # If it has a blob set up, it means we can update given file
        if file.blob:
            file = self.update(file)
        # Otherwise, we create it
        else:
            file = self.put(file)

        if isinstance(file, self.ProxyError):
            return file.response()
        ###########################################
        # Making pull request
        ###########################################

        pr_url = self.pull_request(file)
        if isinstance(pr_url, self.ProxyError):
            return pr_url.response()

        reply = {
            "status": "success",
            "message": "The workflow was well applied",
            "pr_url": pr_url
        }
        data = jsonify(reply)
        data.status_code = 201
        return data