Fields documentation: https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline
779962
def _tweepy_status_to_tweet(self, status):
        
        tweet = Tweet()
        tweet.published_at = status.created_at
        tweet.content = status.text

        return tweet
614403
@Override
    public void getMentions() {
        getDispatcher().invokeLater(new AsyncTask(MENTIONS_TIMELINE, listeners) {
            @Override
            public void invoke(List<TwitterListener> listeners) throws TwitterException {
                ResponseList<Status> statuses = twitter.getMentionsTimeline();
                for (TwitterListener listener : listeners) {
                    try {
                        listener.gotMentions(statuses);
                    } catch (Exception e) { 
                        logger.warn("Exception at getMentions", e);
                    }
                }
            }
        });
    }
1133683
def prev(self):
        """"""
        if self.limit and self.limit == self.num_tweets:
            raise StopIteration

        self.index -= 1
        if self.index < 0:
            # There's no way to fetch a set of tweets directly 'above' the
            # current set
            raise StopIteration

        data = self.results[self.index]
        self.max_id = self.model_results[self.index].max_id
        self.num_tweets += 1
        return data
1071391
def home(request):
    """"""
    recent_uploads = Dataset.objects.order_by('-date_uploaded')[:11]

    email_list = [upload.uploaded_by.strip() for upload in recent_uploads]
    # print all_staff

    emails_names = grab_names_from_emails(email_list)
    # print emails_names

    for upload in recent_uploads:
        for item in emails_names:
            if upload.uploaded_by == item:
                upload.fullName = emails_names[item]

    for upload in recent_uploads:
        if not hasattr(upload, 'fullName'):
            upload.fullName = upload.uploaded_by

    return render(
        request,
        'datafreezer/home.html',
        {
            'recent_uploads': recent_uploads,
            'heading': 'Most Recent Uploads'
        }
    )
767670
public function getStatusesMentionsTimeline(array $parameters = array(), $multipart = false, $appOnlyAuth = false)
    {
        return $this->get('statuses/mentions_timeline', $parameters, $multipart, $appOnlyAuth);
    }
991514
def get_current_status(self):
        """"""
        url = get_url("/remote/status.json")
        params = {"oauth": self._oauth_token, "csrf": self._csrf_token}
        r = self._request(url=url, params=params)
        return r.json()
576645
def search(self, q, max_id=None, since_id=None, lang=None,
               result_type='recent', geocode=None, max_pages=None):
        
        url = "https://api.twitter.com/1.1/search/tweets.json"
        params = {
            "count": 100,
            "q": q,
            "include_ext_alt_text": 'true'
        }
        if lang is not None:
            params['lang'] = lang
        if result_type in ['mixed', 'recent', 'popular']:
            params['result_type'] = result_type
        else:
            params['result_type'] = 'recent'
        if geocode is not None:
            params['geocode'] = geocode

        retrieved_pages = 0
        reached_end = False

        while True:
            if since_id:
                # Make the since_id inclusive, so we can avoid retrieving
                # an empty page of results in some cases
                params['since_id'] = str(int(since_id) - 1)
            if max_id:
                params['max_id'] = max_id

            resp = self.get(url, params=params)
            retrieved_pages += 1

            statuses = resp.json()["statuses"]

            if len(statuses) == 0:
                log.info("no new tweets matching %s", params)
                break

            for status in statuses:
                # We've certainly reached the end of new results
                if since_id is not None and status['id_str'] == str(since_id):
                    reached_end = True
                    break

                yield status

            if reached_end:
                log.info("no new tweets matching %s", params)
                break

            if max_pages is not None and retrieved_pages == max_pages:
                log.info("reached max page limit for %s", params)
                break

            max_id = str(int(status["id_str"]) - 1)
1347443
def get_timeline(source):
    """"""

    # Set up the pandas timeseries dataframe
    timeline_format = ["name", "type", "source", "country", "city", "latitude",
                       "longitude", "website_url", "twitter_url",
                       "facebook_page_url", "facebook_group_url",
                       "whois_start", "whois_end", "wayback_start",
                       "wayback_end", "twitter_start", "twitter_end",
                       "facebook_start", "facebook_end"]
    timeline = pd.DataFrame(timeline_format)

    # Getdata from all the mapped platforms
    if source.lower() == "diybio.org":
        data = diybio_org.get_labs(format="dict")
    elif source.lower() == "fablabs_io":
        data = fablabs_io.get_labs(format="dict")
    elif source.lower() == "makeinitaly_foundation":
        data = makeinitaly_foundation.get_labs(format="dict")
    elif source.lower() == "hackaday_io":
        data = hackaday_io.get_labs(format="dict")
    elif source.lower() == "hackerspaces_org":
        data = hackerspaces_org.get_labs(format="dict")
    elif source.lower() == "makery_info":
        data = makery_info.get_labs(format="dict")
    elif source.lower() == "nesta":
        data = nesta.get_labs(format="dict")
    elif source.lower() == "all":
        pass

    # Fill the dataframe with basic details
    for lab in labs_data:
        for link in lab.links:
            print link
            if "twitter" in link:
                print link
            if "facebook" in link:
                print link
        lab_dataframe_dict = {"name": lab.name,
                              "type": lab.lab_type,
                              "source": lab.source,
                              "country": lab.country,
                              "city": lab.city,
                              "latitude": lab.latitude,
                              "longitude": lab.longitude,
                              "website_url": lab.url}
        timeline.append(lab_dataframe_dict)
        ["name", "type", "source", "country", "city", "lat", "long",
         "website_url", "twitter_url", "facebook_page_url",
         "facebook_group_url", "whois_start", "whois_end", "wayback_start",
         "wayback_end", "twitter_start", "twitter_end", "facebook_start",
         "facebook_end"]

    # Get time data from platforms, whenever possible

    # Get domain data (whois)

    # Get subdomain data (Internet Archive)

    # Get social media data (Twitter)

    # Get social media data (Facebook)

    return timeline
1199816
def timeline(*args)
      load_default_token
      return failtown("Unauthorized, re-run setup!") unless @client && @client.authorized?
      # Only send since_id to @client if it's not nil
      home_timeline = since_id ? @client.home_timeline(:since_id => since_id) : @client.home_timeline
      if home_timeline.any?
        print_tweets(home_timeline)
        # Save the last id as since_id
        self.since_id = home_timeline.last['id']
      end
    end
1117290
public function timelineHome($number = null)
    {
        $params = array();

        // handle number parameter
        if (!is_null($number)) {
            if (!ctype_digit((string)$number) || (0 === $number) || (100 < $number)) {
                throw new \InvalidArgumentException('Invalid number parameter');
            }
            $params['number'] = $number;
        }

        return $this->query('timeline/home.json', $params);
    }
623841
def trends_available(self):
        
        url = 'https://api.twitter.com/1.1/trends/available.json'
        try:
            resp = self.get(url)
        except requests.exceptions.HTTPError as e:
            raise e
        return resp.json()
902535
def _analyse_overview_field(content):
    '''
    
    '''
    if "(" in content:
        # Output like "Connected(2*)" or "UpToDate(2*)"
        return content.split("(")[0], content.split("(")[0]
    elif "/" in content:
        # Output like "Primar/Second" or "UpToDa/UpToDa"
        return content.split("/")[0], content.split("/")[1]

    return content, ""
353021
@SuppressWarnings("unused") // called through reflection by RequestServer
  public TimelineV3 fetch(int version, TimelineV3 s) {
    Timeline t = s.createAndFillImpl();
    t.snapshot = new TimelineSnapshot(H2O.CLOUD,TimeLine.system_snapshot());
    return s.fillFromImpl(t);
  }
467406
def stats(request, date_offset=0, fields=None, title_prefix=None, model='WikiItem'):
    
    data = {}

    modified_chart_data = data['chart']['chartdata']
    if 'y2' in data['chart']['chartdata']:
        matrix = db.Columns([modified_chart_data['y1'], modified_chart_data['y2']], ddof=0, tall=True)
    else:
        fields = ['date/time'] + fields
        matrix = db.Columns([modified_chart_data['x'], modified_chart_data['y']], ddof=0, tall=True)
    if fields and len(fields) > 1:
        fields = fields[:2]
    else:
        fields = [
            data['chart']['chartdata'].get('name1') or 'time',
            data['chart']['chartdata'].get('name2') or data['chart']['chartdata'].get('name') or 'value',
            ]
    fields = util.pluralize_field_names(fields)
    data.update({
        'stats': {
            'fields': fields,
            'heading': 'Statistics',
            'cov': zip(fields, matrix.cov()),
            'R': zip(fields, matrix.rho),
            },
        })
    data['chart']['chartdata'] = modified_chart_data
    data['chart']['chart_title'] = 'Time Series'
    return render_to_response('miner/stats.html', data)
1099272
def get_prev_status_from_history(instance, status=None):
    
    target = status or api.get_workflow_status_of(instance)
    history = getReviewHistory(instance, reverse=True)
    history = map(lambda event: event["review_state"], history)
    if target not in history or history.index(target) == len(history)-1:
        return None
    return history[history.index(target)+1]
515421
def status(ctx, date, f, pushed):
    
    try:
        timesheet_collection = get_timesheet_collection_for_context(ctx, f)
    except ParseError as e:
        ctx.obj['view'].err(e)
    else:
        ctx.obj['view'].show_status(
            timesheet_collection.entries.filter(
                date, regroup=ctx.obj['settings']['regroup_entries'],
                pushed=False if not pushed else None
            )
        )
15051
def get_historical_base_info(event):
    """"""
    data = {
        'principalId': get_principal(event),
        'userIdentity': get_user_identity(event),
        'accountId': event['account'],
        'userAgent': event['detail'].get('userAgent'),
        'sourceIpAddress': event['detail'].get('sourceIPAddress'),
        'requestParameters': event['detail'].get('requestParameters')
    }

    if event['detail'].get('eventTime'):
        data['eventTime'] = event['detail']['eventTime']

    if event['detail'].get('eventSource'):
        data['eventSource'] = event['detail']['eventSource']

    if event['detail'].get('eventName'):
        data['eventName'] = event['detail']['eventName']

    return data