Generic request view.  Parameters:
        request is the HTTP request
        requestType is URL name of a RequestType.
            e.g. "food", "maintenance", "network", "site"
976671
def requests_view(request, requestType):
    '''
    
    '''
    userProfile = UserProfile.objects.get(user=request.user)
    request_type = get_object_or_404(RequestType, url_name=requestType)
    page_name = "{0} Requests".format(request_type.name.title())
    if not request_type.enabled:
        message = "{0} requests have been disabled.".format(request_type.name.title())
        return red_home(request, message)
    relevant_managers = request_type.managers.filter(active=True)
    manager = any(i.incumbent == userProfile for i in relevant_managers)
    request_form = RequestForm(
        request.POST if "submit_request" in request.POST else None,
        profile=userProfile,
        request_type=request_type,
        )
    if request_form.is_valid():
        request_form.save()
        return HttpResponseRedirect(reverse('managers:requests', kwargs={'requestType': requestType}))
    # number of requests loaded
    x = 0
    # A pseudo-dictionary, actually a list with items of form (request,
    # [request_responses_list], response_form, upvote, vote_form)
    requests_dict = list()
    requests = Request.objects.filter(request_type=request_type)
    if not request_type.managers.filter(incumbent__user=request.user):
        requests = requests.exclude(
            ~Q(owner__user=request.user), private=True,
            )
    for req in requests:
        request_responses = Response.objects.filter(request=req)
        if manager:
            response_form = ManagerResponseForm(
                request.POST if "add_response-{0}".format(req.pk) in request.POST else None,
                initial={'action': Response.NONE},
                prefix="{0}".format(req.pk),
                profile=userProfile,
                request=req,
                )
        else:
            response_form = ResponseForm(
                request.POST if "add_response-{0}".format(req.pk) in request.POST else None,
                prefix="{0}".format(req.pk),
                profile=userProfile,
                request=req,
                )
        upvote = userProfile in req.upvotes.all()
        vote_form = VoteForm(
            request.POST if "vote-{0}".format(req.pk) in request.POST else None,
            profile=userProfile,
            request=req,
            )
        if response_form.is_valid():
            response_form.save()
            return HttpResponseRedirect(reverse('managers:requests',
                                                kwargs={'requestType': requestType}))
        if vote_form.is_valid():
            vote_form.save()
            return HttpResponseRedirect(reverse('managers:requests',
                                                kwargs={'requestType': requestType}))
        requests_dict.append((req, request_responses, response_form, upvote, vote_form))
        x += 1
        if x >= settings.MAX_REQUESTS:
            break
    return render_to_response('requests.html', {
        'manager': manager,
        'request_type': request_type,
        'page_name': page_name,
        'request_form': request_form,
        'requests_dict': requests_dict,
        'relevant_managers': relevant_managers,
        }, context_instance=RequestContext(request))
503770
def get_wsgi_request_object(curr_request, method, url, headers, body):
    '''
        
    '''
    x_headers = headers_to_include_from_request(curr_request)
    method, t_headers = pre_process_method_headers(method, headers)

    # Add default content type.
    if "CONTENT_TYPE" not in t_headers:
        t_headers.update({"CONTENT_TYPE": _settings.DEFAULT_CONTENT_TYPE})

    # Override existing batch requests headers with the new headers passed for this request.
    x_headers.update(t_headers)

    content_type = x_headers.get("CONTENT_TYPE", _settings.DEFAULT_CONTENT_TYPE)

    # Get hold of request factory to construct the request.
    _request_factory = BatchRequestFactory()
    _request_provider = getattr(_request_factory, method)

    secure = _settings.USE_HTTPS

    request = _request_provider(url, data=body, secure=secure,
                                content_type=content_type, **x_headers)

    return request
627695
public static boolean isHttpPostRequest(HttpServletRequest request) {
        boolean isSane = isSaneRequest(request);
        boolean isPost = isSane && request.getMethod().equals(HttpMethod.POST.toString());
        return isSane && isPost;
    }
280214
def _request(self, url, request_type='GET', **params):
        """"""
        try:
            _LOGGER.debug('Request %s %s', url, params)
            response = self.request(
                request_type, url, timeout=TIMEOUT.seconds, **params)
            response.raise_for_status()
            _LOGGER.debug('Response %s %s %.200s', response.status_code,
                          response.headers['content-type'], response.json())
            response = response.json()
            if 'error' in response:
                raise OSError(response['error'])
            return response
        except OSError as error:
            _LOGGER.warning('Failed request: %s', error)
1249755
def request(request_type, params)
      url = '/WebObjects/MZStoreServices.woa/wa/ws' + request_type

      response = connection.get do |req|
        req.url url, params
        req.options.timeout = Configuration::DEFAULT_REQUEST_OPTIONS[:timeout]
        req.options.open_timeout = Configuration::DEFAULT_REQUEST_OPTIONS[:open_timeout]
      end
      response.body
    end
1333895
def get_request_from_view_args(
        self, view: typing.Callable, args: typing.Iterable, kwargs: typing.Mapping
    ) -> Request:
        
        req = None
        for arg in args:
            if isinstance(arg, web.Request):
                req = arg
                break
            elif isinstance(arg, web.View):
                req = arg.request
                break
        assert isinstance(req, web.Request), "Request argument not found for handler"
        return req
793708
def get_request_from_view_args(self, view, args, kwargs):
        
        if len(args) > 1 and isinstance(args[1], sanic.request.Request):
            req = args[1]
        else:
            req = args[0]
        assert isinstance(
            req, sanic.request.Request
        ), "Request argument not found for handler"
        return req
341723
def parse_request(self, request, parameters, fake_method=None):
        '''
        
        '''
        return (fake_method or request.method,
                request.build_absolute_uri(),
                request.META,
                (dict(request.POST.iteritems())
                    if request.method == 'POST'
                    else parameters))
895403
def scope_types(self, request, *args, **kwargs):
        
        return response.Response(utils.get_scope_types_mapping().keys())
1198360
public static boolean isFormData(HttpRequest<?> request) {
        Optional<MediaType> opt = request.getContentType();
        if (opt.isPresent()) {
            MediaType contentType = opt.get();
            return (contentType.equals(MediaType.APPLICATION_FORM_URLENCODED_TYPE) || contentType.equals(MediaType.MULTIPART_FORM_DATA_TYPE));
        }
        return false;
    }
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)]
490336
def post(self, request, *args, **kwargs):
        
        return self.update_type(request, *args, **kwargs)
433041
public void checkContentType(final HttpServletRequest request) {
    String reqpar = request.getParameter(getContentTypeRequestName());

    if (reqpar != null) {
      if (reqpar.equals("!")) {
        // Go back to unsticky content type
        setContentTypeSticky(false);
      } else {
        setContentType(reqpar);
        setContentTypeSticky(false);
      }
    }

    reqpar = request.getParameter(getContentTypeStickyRequestName());
    if (reqpar != null) {
      if (reqpar.equals("!")) {
        // Go back to unsticky content type
        setContentTypeSticky(false);
      } else {
        setContentType(reqpar);
        setContentTypeSticky(true);
      }
    }
  }
90668
def request_info(self, request):

		

		# We have to re-resolve the request path here, because the information
		# is not stored on the request.
		view, args, kwargs = resolve(request.path)
		for i, arg in enumerate(args):
			kwargs[i] = arg

		parameters = {}
		parameters.update(kwargs)
		parameters.update(request.POST.items())

		environ = request.META

		return {
				"session": dict(request.session),
				'cookies': dict(request.COOKIES),
				'headers': dict(get_headers(environ)),
                'env': dict(get_environ(environ)),
				"remote_ip": request.META["REMOTE_ADDR"],
				"parameters": parameters,
				"action": view.__name__,
				"application": view.__module__,
				"method": request.method,
				"url": request.build_absolute_uri()
		}
835110
private void addQueryParams(final Request request) {
        if (type != null) {
            for (Channel.ChannelType prop : type) {
                request.addQueryParam("Type", prop.toString());
            }
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
83407
@SuppressWarnings("unchecked")
	public static <T> Response<T> getInstanceOfParameterizedType(Request<T> request) {
		Type superclazz = request.getClass().getGenericSuperclass();
		try {
			Type parameterizedTypeClazz = ((ParameterizedType) superclazz).getActualTypeArguments()[0];
			return (Response<T>) ((Class<T>) parameterizedTypeClazz).newInstance();
		} catch (Exception e) {
			return null;
		}
	}
298903
private QueryBuilder genericRequest(String type, String value) throws Exception {
        JSONObject op = new JSONObject();
        op.put(type, value);
        JSONArray operations = (JSONArray) request.get(Constants.REQUEST_OPERATIONS);
        operations.put(op);
        request.remove(Constants.REQUEST_OPERATIONS);
        request.put(Constants.REQUEST_OPERATIONS, operations);
        return this;
    }