Create a pull request with the form contents
512805
def create_pull_request
      unless uploads.empty?
        branch = patch_branch
        create_branch(branch)
        uploads.each do |key, upload|
          client.create_contents(
            repo,
            upload[:filename],
            "Create #{upload[:filename]}",
            branch: branch,
            file: upload[:tempfile]
          )
          session["file_#{key}"] = nil
        end
      end
      pr = client.create_pull_request(repo, 'master', branch, form_data['title'], issue_body, labels: labels)
      pr['number'] if pr
    end
806531
def create_form_data(self, **kwargs):
        """"""
        # Get the specified keyword arguments.
        children = kwargs.get('children', [])
        sort_order = kwargs.get('sort_order', None)
        solr_response = kwargs.get('solr_response', None)
        superuser = kwargs.get('superuser', False)
        # Get the vocabularies to pull the qualifiers from.
        vocabularies = self.get_vocabularies()
        # Loop through all UNTL elements in the Python object.
        for element in children:
            # Add children that are missing from the form.
            element.children = add_missing_children(
                element.contained_children,
                element.children,
            )
            # Add the form attribute to the element.
            element.add_form(
                vocabularies=vocabularies,
                qualifier=element.qualifier,
                content=element.content,
                superuser=superuser,
            )
            # Element can contain children.
            if element.form.has_children:
                # If the parent has a qualifier,
                # create a representative form element for the parent.
                if getattr(element.form, 'qualifier_name', False):
                    add_parent = PARENT_FORM[element.form.qualifier_name](
                        content=element.qualifier,
                    )
                    # Add the parent to the list of child elements.
                    element.children.append(add_parent)
                # Sort the elements by the index of child sort.
                element.children.sort(
                    key=lambda obj: element.form.child_sort.index(obj.tag)
                )
                # Loop through the element's children (if it has any).
                for child in element.children:
                    # Add the form attribute to the element.
                    child.add_form(
                        vocabularies=vocabularies,
                        qualifier=child.qualifier,
                        content=child.content,
                        parent_tag=element.tag,
                        superuser=superuser,
                    )
        element_group_dict = {}
        # Group related objects together.
        for element in children:
            # Make meta-hidden its own group.
            if element.form.name == 'meta' and element.qualifier == 'hidden':
                element_group_dict['hidden'] = [element]
            # Element is not meta-hidden.
            else:
                # Make sure the dictionary key exists.
                if element.form.name not in element_group_dict:
                    element_group_dict[element.form.name] = []
                element_group_dict[element.form.name].append(element)
        # If the hidden meta element doesn't exist, add it to its own group.
        if 'hidden' not in element_group_dict:
            hidden_element = PYUNTL_DISPATCH['meta'](
                qualifier='hidden',
                content='False')
            hidden_element.add_form(
                vocabularies=vocabularies,
                qualifier=hidden_element.qualifier,
                content=hidden_element.content,
                superuser=superuser,
            )
            element_group_dict['hidden'] = [hidden_element]
        # Create a list of group object elements.
        element_list = self.create_form_groupings(
            vocabularies,
            solr_response,
            element_group_dict,
            sort_order,
        )
        # Return the list of UNTL elements with form data added.
        return element_list
625757
def get_form(self, request, obj=None, **kwargs):
        """"""
        #form = super(PageAdmin, self).get_form(request, obj, **kwargs)
        template = get_template_from_request(request, obj)
        form = make_form(self.model, get_placeholders(template))

        language = get_language_from_request(request)
        form.base_fields['language'].initial = language
        if obj:
            initial_slug = obj.slug(language=language, fallback=False)
            initial_title = obj.title(language=language, fallback=False)
            form.base_fields['slug'].initial = initial_slug
            form.base_fields['title'].initial = initial_title
            form.base_fields['slug'].label = _('Slug')

        template = get_template_from_request(request, obj)
        page_templates = settings.get_page_templates()
        if len(page_templates) > 0:
            template_choices = list(page_templates)
            template_choices.insert(0, (settings.PAGE_DEFAULT_TEMPLATE,
                    _('Default template')))
            form.base_fields['template'].choices = template_choices
            form.base_fields['template'].initial = force_text(template)

        for placeholder in get_placeholders(template):
            name = placeholder.name
            if obj:
                initial = placeholder.get_content(obj, language, name)
            else:
                initial = None
            form.base_fields[name] = placeholder.get_field(obj,
                language, initial=initial)

        for placeholder in self.metadata_fields:
            name = placeholder['name']
            initial = None
            if obj:
                try:
                    initial = Content.objects.get(page=obj, language=language, type=name).body
                except Content.DoesNotExist:
                    pass
            form.base_fields[name] = placeholder['field']
            form.base_fields[name].initial = initial

        return form
932166
def parse_form(self, req, name, field):
        """"""
        return get_value(req.body_arguments, name, field)
884084
def fetch(self):
        
        params = values.of({})

        payload = self._version.fetch(
            'GET',
            self._uri,
            params=params,
        )

        return FormInstance(self._version, payload, form_type=self._solution['form_type'], )
508198
def _request(self, data):
        """"""
        return requests.post(self.endpoint, data=data.encode("ascii")).content
1059353
def get(self, request, *args, **kwargs):
        
        form_class = self.get_form_class()
        form = self.get_form(form_class)
        if form.is_valid():
            return self.form_valid(form)

        else:
            return self.form_invalid(form)
1248991
def update_request(self, request, form):
        """"""
        forms_key = '%s_forms' % self.flow_type

        # Use ordered forms dict in case _formNode wants to fetch the first defined.
        flow_dict = OrderedDict()
        try:
            flow_dict = request.sitegate[forms_key]
        except AttributeError:
            request.sitegate = {}
        except KeyError:
            pass

        flow_dict[self.get_flow_name()] = form
        request.sitegate[forms_key] = flow_dict
851317
def get_request(self, request):
        
        return [DownloadRequest(url=self._get_url(item),
                                filename=self._get_filename(request, item),
                                data_type=request.image_format)
                for item in self._get_items(request)]
1115174
function getResults( form, url, callback ){
    var formData = new FormData( form );
    var request = new XMLHttpRequest();
    request.open("POST", url);
    request.send(formData);
    
    request.onload = function(e) {
     if (request.status == 200) {
            callback(null, JSON.parse(request.responseText));
        } else {
            callback("Error " + request.status + ' - ' + request.responseText, null);
        }
    };
}
158975
function() {
        var form = this.element.find('form:first');

        if (!form) {
            return;
        }

        this.fireEvent('submit', [form]);

        var options = {
            url: form.attr('action'),
            type: (form.attr('method') || 'post').toUpperCase()
        };

        if (window.FormData) {
            options.processData = false;
            options.contentType = false;
            options.data = new FormData(form[0]);
        } else {
            options.data = form.serialize();
        }

        this.requestData(options);
    }
235010
function makeRequest(){
  output('Sending the request...');
  var options = {
    method: $method.value,
    headers: {
      Accept: document.getElementById('accept').value
    },
    followRedirect: $followRedirect.checked
  };
  if(options.method === 'POST'){
    options.body = $requestBody.value;
  }
  client.request($url.value, options, function(error, response){
    if(error){
      genericError();
    } else {
      displayResponse(response);
      
      if(response.statusCode === 401){
        $authStatus.classList.remove('loggedin');
        $tokenDisplay.value = '';
        
      } else {
        $authStatus.classList.add('loggedin');
        $tokenDisplay.value = 'Bearer ' + client.getAccessToken();
      }
    }
  });
}
306686
def make_request!(pickup_location, options, notes = '')
      resp = request_item_request(pickup_location, options, notes)

      number = extract_request_number(resp)

      if number.nil?
        raise BorrowDirect::Error.new("Can not request for: #{options.inspect}: #{resp.inspect}")
      end

      return number
    end
1103286
def _gen_form_data(self) -> multipart.MultipartWriter:
        """"""
        for dispparams, headers, value in self._fields:
            try:
                if hdrs.CONTENT_TYPE in headers:
                    part = payload.get_payload(
                        value, content_type=headers[hdrs.CONTENT_TYPE],
                        headers=headers, encoding=self._charset)
                else:
                    part = payload.get_payload(
                        value, headers=headers, encoding=self._charset)
            except Exception as exc:
                raise TypeError(
                    'Can not serialize value type: %r\n '
                    'headers: %r\n value: %r' % (
                        type(value), headers, value)) from exc

            if dispparams:
                part.set_content_disposition(
                    'form-data', quote_fields=self._quote_fields, **dispparams
                )
                # FIXME cgi.FieldStorage doesn't likes body parts with
                # Content-Length which were sent via chunked transfer encoding
                assert part.headers is not None
                part.headers.popall(hdrs.CONTENT_LENGTH, None)

            self._writer.append_payload(part)

        return self._writer
25542
public function generateRequest()
    {
        if (!$this->confirm('Do you want to create form request classes?')) {
            return;
        }

        foreach (['Create', 'Update'] as $request) {
            $name = $this->getPrefix('/').$this->getEntities().'/'.$request.Str::studly($this->getEntity()).'Request';

            $this->console->call('generate:request', [
                'name' => $name,
                '--scaffold' => true,
                '--auth' => true,
                '--rules' => $this->console->option('fields'),
                '--force' => $this->console->option('force'),
            ]);
        }
    }
1160492
def form_processor(request, page):
    
    form = FormForForm(page.form, RequestContext(request),
                       request.POST or None, request.FILES or None)
    if form.is_valid():
        url = page.get_absolute_url() + "?sent=1"
        if is_spam(request, form, url):
            return redirect(url)
        attachments = []
        for f in form.files.values():
            f.seek(0)
            attachments.append((f.name, f.read()))
        entry = form.save()
        subject = page.form.email_subject
        if not subject:
            subject = "%s - %s" % (page.form.title, entry.entry_time)
        fields = [(v.label, format_value(form.cleaned_data[k]))
                  for (k, v) in form.fields.items()]
        context = {
            "fields": fields,
            "message": page.form.email_message,
            "request": request,
        }
        email_from = page.form.email_from or settings.DEFAULT_FROM_EMAIL
        email_to = form.email_to()
        if email_to and page.form.send_email:
            send_mail_template(subject, "email/form_response", email_from,
                               email_to, context)
        headers = None
        if email_to:
            # Add the email entered as a Reply-To header
            headers = {'Reply-To': email_to}
        email_copies = split_addresses(page.form.email_copies)
        if email_copies:
            send_mail_template(subject, "email/form_response_copies",
                               email_from, email_copies, context,
                               attachments=attachments, headers=headers)
        form_valid.send(sender=request, form=form, entry=entry)
        return redirect(url)
    form_invalid.send(sender=request, form=form)
    return {"form": form}
313529
def request(params={})
      normalize_parameters params
      raise UnmetRequirementsError, "Required parameters: #{requirements}" \
        unless meets_requirements? params
      credentials = pull_credentials params
      pairs = pull_url_pairs params
      request = construct_request expand_url(pairs), params, credentials
      yield request if block_given?
      request
    end