POST /screenshots/ignored
976206
def cancel
      # there has got to be a sexy ruby way of doing this
      crawl_statuses.each do |job|
        next unless is_job_running(job.status)
        job_id = job.uuid
        puts 'cancelling job_id: ' + job_id.to_s
        Resque::Plugins::Status::Hash.kill(job_id)
      end

      # and for good measure
      `redis-cli FLUSHALL`

      head :ok
    end
370697
def share_bar_for_post(post)
      return "" unless Blogit.configuration.include_share_bar
      render(partial: "blogit/posts/share_bar", locals: { post: post})
    end
180532
def do_POST(self):
        '''
        '''
        global _contexts

        soapAction = self.headers.getheader('SOAPAction')
        post = self.path
        if not post:
            raise PostNotSpecified, 'HTTP POST not specified in request'
        if soapAction:
            soapAction = soapAction.strip('\'"')
        post = post.strip('\'"')
        try:
            ct = self.headers['content-type']
            if ct.startswith('multipart/'):
                cid = resolvers.MIMEResolver(ct, self.rfile)
                xml = cid.GetSOAPPart()
                ps = ParsedSoap(xml, resolver=cid.Resolve, readerclass=DomletteReader)
            else:
                length = int(self.headers['content-length'])
                ps = ParsedSoap(self.rfile.read(length), readerclass=DomletteReader)
        except ParseException, e:
            self.send_fault(FaultFromZSIException(e))
        except Exception, e:
            # Faulted while processing; assume it's in the header.
            self.send_fault(FaultFromException(e, 1, sys.exc_info()[2]))
        else:
            # Keep track of calls
            thread_id = thread.get_ident()
            _contexts[thread_id] = SOAPContext(self.server, xml, ps,
                                               self.connection,
                                               self.headers, soapAction)

            try:
                _Dispatch(ps, self.server, self.send_xml, self.send_fault,
                    post=post, action=soapAction)
            except Exception, e:
                self.send_fault(FaultFromException(e, 0, sys.exc_info()[2]))

            # Clean up after the call
            if _contexts.has_key(thread_id):
                del _contexts[thread_id]
473564
def _store_post(self, stored_entry, entry=None):
        
        stored_entry.content_type = self.type
        if 1==1 or self.type == 'photos': # ignore type for now
            # is photo
            width = int(entry.width.text)
            height = int(entry.height.text)
            orientation = 'landscape' if width > height else 'portrait'
            max = width if width > height else height
            thumbnails = {}
            sizes = ['72', '144', '288', '480', '512', '800', '1200', '1600']
            for thumb in entry.media.thumbnail:
                size = thumb.width if width > height else thumb.height
                thumbnails['s%s' % size] = {
                    'url': thumb.url,
                    'height': thumb.height,
                    'width': thumb.width
                }
            for size in sizes[3:]:
                big = size
                small = str(int(int(size)/(float(72)/float(thumbnails['s72']['height' if width > height else 'width']))))
                thumbnails['s%s' % size] = {
                    'url': thumbnails['s72']['url'].replace('s72', 's%s' % size),
                    'height': big if height > width else small,
                    'width': small if height > width else big
                }
            url = thumbnails['s144']['url'].replace('s144', 's%s' % max)
            stored_entry.link = self._get_entry_link(entry)
            summarytext = ''
            if entry.summary.text != None:
                summarytext = unicode(entry.summary.text, "utf-8")
            stored_entry.summary = summarytext
            stored_entry.title = unicode(entry.title.text, "utf-8")
            stored_entry.categories = 'photos'
            stored_entry.published = datetime.datetime.strptime(entry.published.text, '%Y-%m-%dT%H:%M:%S.%fZ')
            stored_entry.updated = datetime.datetime.strptime(entry.updated.text, '%Y-%m-%dT%H:%M:%S.%fZ')
            stored_entry.author = entry.albumid.text
            stored_entry.attributes = simplejson.dumps({
                'id': entry.gphoto_id.text,
                'thumbnails': thumbnails,
                'url': url,
                'width': str(width),
                'height': str(height),
                'orientation': orientation
            })
#        elif self.type == 'albums':
#            # is albums
#            summarytext = ''
#            if entry.summary.text != None:
#                summarytext = unicode(entry.summary.text, "utf-8")
#            itemLink = entry.link[1].href
#            stored_entry.name = itemLink[itemLink.rfind('/')+1:]
#            stored_entry.categories = 'albums'
#            stored_entry.title = unicode(entry.title.text, "utf-8")
#            stored_entry.published = datetime.datetime.strptime(entry.published.text, '%Y-%m-%dT%H:%M:%S.%fZ')
#            stored_entry.updated = datetime.datetime.strptime(entry.updated.text, '%Y-%m-%dT%H:%M:%S.%fZ')
#            stored_entry.author = entry.user.text
#            stored_entry.summary = summarytext
#            stored_entry.attributes = simplejson.dumps({
#                'id': entry.gphoto_id.text,
#                'thumbnail': entry.media.thumbnail[0].url,
#        })
        return super(Picasa, self)._store_post(stored_entry)
720213
function images(user, keyPath, ipAddress, cb) {
  var cmd = [
    'sh',
    __dirname + '/scripts/getImages.sh',
    user,
    keyPath,
    ipAddress
  ].join(' ');

  logger.debug('images: ' + cmd);
  childProcess.exec(cmd, function(err, stdout, stderr) {
    logger.debug('images err: ' + err);
    logger.debug('images stdout: ' + stdout);
    logger.debug('images stderr: ' + stderr);
    cb(err, parseOutput(stdout, stderr));
  });
}
1105372
private void handlePosterRequest() {
		Image poster = getComponentModel().poster;

		if (poster != null) {
			ContentEscape escape = new ContentEscape(poster);
			escape.setCacheable(!Util.empty(getCacheKey()));
			throw escape;
		} else {
			LOG.warn("Client requested non-existant poster");
		}
	}
1369148
def upload_messages_screenshot(app_version, upload_image, device)
      raise "app_version is required" unless app_version
      raise "upload_image is required" unless upload_image
      raise "device is required" unless device

      du_client.upload_messages_screenshot(app_version, upload_image, content_provider_id, sso_token_for_image, device)
    end
101509
def error(self, text, screenshot=None):
        
        step = {
            'time': '%.1f' % (time.time()-self.start_time,),
            'action': 'error',
            'description': text,
            'success': False,
        }   
        if screenshot:
            step['screenshot'] = self._take_screenshot(screenshot, name_prefix='error')
        self.steps.append(step)
426107
def work(path)
      out = "#{path}/#{@name}.png"
      @fetcher.fetch(output: out, width: @size[0], height: @size[1], dpi: @dpi)
    rescue Screencap::Error
      puts "Fail to capture screenshot #{@url}"
    end
1026006
@Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    if (req.getRequestURI().endsWith("upload")) {
      uploadCallback(req, resp);
    } else {
      resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
    }
  }
857022
def resolve_post(self, post):
        
        try:
            cid = post["id"]
        except KeyError:
            cid = post

        params = {
            "cid": cid,
            "resolved": "true"
        }

        return self._rpc.content_mark_resolved(params)
731331
def scan_posts(self, really=True, ignore_quit=False, quiet=True):
        """"""
        while (self.db.exists('site:lock') and
               int(self.db.get('site:lock')) != 0):
            self.logger.info("Waiting for DB lock...")
            time.sleep(0.5)
        self.db.incr('site:lock')
        self.logger.info("Lock acquired.")
        self.logger.info("Scanning site...")

        self._site.scan_posts(really, ignore_quit, quiet)

        timeline = []
        for post in self._site.timeline:
            data = [post.source_path, post.folder, post.is_post,
                    post._template_name, post.compiler.name]
            timeline.append(json.dumps(data))
        self.db.delete('site:timeline')
        if timeline:
            self.db.rpush('site:timeline', *timeline)

        self._write_indexlist('posts')
        self._write_indexlist('all_posts')
        self._write_indexlist('pages')

        self.db.incr('site:rev')

        self.db.decr('site:lock')
        self.logger.info("Lock released.")
        self.logger.info("Site scanned.")
        self.reload_site()
928611
function postFn (req, res, next) {
    var body = req.body;
    var reqPath = req.params[0];
    debug('postFn', 'reqPath', reqPath);

    if (body.type === 'folder') {
      mkdirp(path.join(ramlPath, reqPath), function (err) {
        if (err) return next(err);
        res.sendStatus(201);
      });
      return;
    }

    fs.writeFile(path.join(ramlPath, reqPath), body.content, function (err) {
      if (err) return next(err);
      res.sendStatus(201);
    });
  }
288192
async def post_data(self, path, data=None, headers=None, timeout=None):
        """"""
        url = self.base_url + path
        _LOGGER.debug('POST URL: %s', url)
        self._log_data(data, False)

        resp = None
        try:
            resp = await self._session.post(
                url, headers=headers, data=data,
                timeout=DEFAULT_TIMEOUT if timeout is None else timeout)
            if resp.content_length is not None:
                resp_data = await resp.read()
            else:
                resp_data = None
            self._log_data(resp_data, True)
            return resp_data, resp.status
        except Exception as ex:
            if resp is not None:
                resp.close()
            raise ex
        finally:
            if resp is not None:
                await resp.release()
205556
def _add_assert(self, **kwargs):
        
        # convert screenshot to relative path from <None|True|False|PIL.Image>
        screenshot = kwargs.get('screenshot')
        is_success = kwargs.get('success')
        screenshot = (not is_success) if screenshot is None else screenshot
        kwargs['screenshot'] = self._take_screenshot(screenshot=screenshot, name_prefix='assert')
        action = kwargs.pop('action', 'assert')
        self.add_step(action, **kwargs)
        if not is_success:
            message = kwargs.get('message')
            frame, filename, line_number, function_name, lines, index = inspect.stack()[2]
            print('Assert [%s: %d] WARN: %s' % (filename, line_number, message))
            if not kwargs.get('safe', False):
                raise AssertionError(message)
1208532
function pipePhotoPostHandler(){

    var fileNameValue =  $('#filename').val() || _photoToUse.split('/').pop() || 'photopipe_'
    var fileExtension = ''
    var hasFileExt = (/\.(gif|jpg|jpeg|png|bmp)/gi.exec(_photoToUse))
    var fileExtension = (hasFileExt && hasFileExt.length) ? hasFileExt[0] : '.jpg'

    fileNameValue = encodeURI( (fileNameValue + fileExtension) )

    // If the filebegins with a question mark, make it empty string
    if(fileNameValue.charAt(0) === '?') fileNameValue = ''
    
    console.dir(hasFileExt)
    console.log(fileExtension)    
    console.log(fileNameValue)    
    console.log(_photoToUse)
    
    $
    .post("/smoke",{
      type: _photoDestination,
      photoUrl: localStorage.imageToPipe,
      filename: fileNameValue,
      caption: $caption.val() || null
    })
    .success(function(data){ 

      $spin.hide()

      if(_photoDestination === 'download'){
        // console.dir(data)
        downloadFile(data)
      }
      else{
        // console.dir(data)
        alert('Success!')
        // window.location = "/"
      }

    })
    .error(function(e) {
      $spin.hide()
      if(e.status === 400) alert(e.responseText || 'Bad request.')
      if(e.status === 401) alert(e.responseText || 'Unauthorized request.')
      if(e.status === 402) alert(e.responseText || 'Forbidden request.')
      if(e.status === 403) alert(e.responseText || 'Forbidden request.')
      if(e.status === 404) alert(e.responseText || 'Images were not found.')
      if(e.status === 405) alert(e.responseText || 'That method is not allowed.')
      if(e.status === 408) alert(e.responseText || 'The request timed out. Try again.')
      if(e.status === 500) alert(e.responseText || 'Something went really wrong.')
      
      // TODO: RESTART AT STEP ONE? 0N 403 YES.
      if(e.status === 403 && (e.responseText.regexIndexOf(/twitter/gi) > -1)) window.location = "/twitter"
      if(e.status === 403 && (e.responseText.regexIndexOf(/facebook/gi) > -1)) window.location = "/facebook"
      if(e.status === 403 && (e.responseText.regexIndexOf(/instagram/gi) > -1)) window.location = "/instagram"
    })
    
    return false
    
  }
904654
private void initScreenShotSaver() {
		if(screenShotSaverThread == null || screenShotSaver == null) {
			screenShotSaverThread = new HandlerThread("ScreenShotSaver");
			screenShotSaverThread.start();
			screenShotSaver = new ScreenShotSaver(screenShotSaverThread);
		}
	}