def get_pics(): while True: last_id = environ.get("TWITTER_LAST_MEDIA_ID") results = twitter_api.GetSearch(term="#selfie", since_id=last_id, result_type="popular") results.reverse() for r in results: last_id = r.id for m in r.media: url = m["media_url_https"] print(url) sleep(4) yield url settings.write_config("TWITTER_LAST_MEDIA_ID", r.id)
def _settings(self): try: import settings self.settings_chunk = trim(settings.write_config(self)) self.settings = True except: self.settings = False self.settings_chunk = trim("""\ # ------------------ USER DATABASE CONFIGURATION ------------------ # The user database was not set up at install. Please consult the documentation, # or run the configuration utility if you wish to use it.""") print trim(""" The configuration utility will now attempt to find modules with their own configuration needs. """)