Example #1
0
    def post(self):
        su_id = self.request.get("id")

        startup = model.Startup.get_by_id(int(su_id))

        if startup.blob_key:
            utils.delete_blob(startup.blob_key)#deletes serving url and blob of an image blob

        startup.key.delete()
Example #2
0
    def post(self):
        su_id = self.request.get("id")

        startup = model.Startup.get_by_id(int(su_id))

        if startup.blob_key:
            utils.delete_blob(startup.blob_key)#deletes serving url and blob of an image blob

        startup.key.delete()
Example #3
0
def downloader_function(thing, thing2):
    date = (datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)).days
    people = [
        "bijanmustard", "7e5h", "dadurath", "sagebeans", "spinebashed",
        "theonion", "clickhole"
    ]
    who = people[date % len(people)]
    tweet_dumper.get_all_tweets(who)
    delete_blob("twitter_bot_bucket", f"{who}-clean.txt")
    upload_blob("twitter_bot_bucket", f"/tmp/{who}-clean.txt",
                f"{who}-clean.txt")
Example #4
0
    def post(self, startup_id):
        upload_files = self.get_uploads('new_logo')

        logging.error(upload_files)

        blob_info = upload_files[0]
        blob_key = blob_info.key()

        serving_url = utils.get_blob_serving_url(blob_key)

        startup = model.Startup.get_by_id(int(startup_id))
        tw = model.TwitterApi.query().get()

        #delete old blob
        if startup.blob_key:
            utils.delete_blob(startup.blob_key)

        startup.blob_key = blob_key
        startup.new_logo = serving_url
        startup.approved = True
        startup.put()

        year = datetime.datetime.now().year

        if startup.q4:
            if int(startup.q2) == year:
                status = "New #startup on %s: %s via %s" % (
                    tw.tw_short_url, startup.q4, tw.tw_handle)
                #status = "Check out the hot new SA #startup, %s, via @foundedinsa bit.ly/1ugm5eG" % startup.q4
            else:
                status = "Featured #startup on %s: %s via %s" % (
                    tw.tw_short_url, startup.q4, tw.tw_handle)
        else:
            if int(startup.q2) == year:
                status = "New #startup on %s: %s via %s" % (
                    tw.tw_short_url, startup.q4, tw.tw_handle)
            else:
                status = "Featured #startup on %s: %s via %s" % (
                    tw.tw_short_url, startup.q4, tw.tw_handle)

        try:
            tweet(status)
            #pass
        except tweepy.TweepError as e:
            logging.error(e.response.status)

        #status = "Checkout the hot new SA startup, %s" % startup.q4

        #tweet(serving_url, status)

        self.redirect("/dashboard/logo")
Example #5
0
    def post(self, startup_id):
        upload_files = self.get_uploads('new_logo')

        logging.error(upload_files)

        blob_info = upload_files[0]
        blob_key = blob_info.key()

        serving_url = utils.get_blob_serving_url(blob_key)
        
        startup = model.Startup.get_by_id(int(startup_id))
        tw = model.TwitterApi.query().get()

        #delete old blob
        if startup.blob_key:
            utils.delete_blob(startup.blob_key)

        startup.blob_key = blob_key
        startup.new_logo = serving_url
        startup.approved = True
        startup.put()


        year = datetime.datetime.now().year

        if startup.q4:
            if int(startup.q2) == year:
                status = "New #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )
                #status = "Check out the hot new SA #startup, %s, via @foundedinsa bit.ly/1ugm5eG" % startup.q4
            else:
                status = "Featured #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )
        else:
            if int(startup.q2) == year:
                status = "New #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )
            else:
                status = "Featured #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )

        try:
            tweet(status)
            #pass
        except tweepy.TweepError as e:
            logging.error(e.response.status)


        #status = "Checkout the hot new SA startup, %s" % startup.q4

        #tweet(serving_url, status)

        self.redirect("/dashboard/logo")
Example #6
0
    def post(self, feature_id):
        upload_files = self.get_uploads('new_logo')

        blob_info = upload_files[0]
        blob_key = blob_info.key()

        serving_url = utils.get_blob_serving_url(blob_key)
        
        feature = model.Feature.get_by_id(int(feature_id))
        
        #delete old blob
        if feature.blob_key:
            utils.delete_blob(feature.blob_key)

        feature.blob_key = blob_key
        feature.new_logo = serving_url
        feature.put()
        self.redirect('/dashboard/feature_edit/%s' % feature_id)
Example #7
0
    def post(self, feature_id):
        upload_files = self.get_uploads('new_logo')

        blob_info = upload_files[0]
        blob_key = blob_info.key()

        serving_url = utils.get_blob_serving_url(blob_key)

        feature = model.Feature.get_by_id(int(feature_id))

        #delete old blob
        if feature.blob_key:
            utils.delete_blob(feature.blob_key)

        feature.blob_key = blob_key
        feature.new_logo = serving_url
        feature.put()
        self.redirect('/dashboard/feature_edit/%s' % feature_id)
Example #8
0
    def post(self, startup_id):
        upload_files = self.get_uploads('new_logo')

        blob_info = upload_files[0]
        blob_key = blob_info.key()

        serving_url = utils.get_blob_serving_url(blob_key)
        
        startup = model.Startup.get_by_id(int(startup_id))
        tw = model.TwitterApi.query().get()

        #delete old blob
        if startup.blob_key:
            utils.delete_blob(startup.blob_key)

        startup.blob_key = blob_key
        startup.new_logo = serving_url
        startup.approved = True
        startup.put()


        year = datetime.datetime.now().year


        auto_tweet = tw.auto_tweet
        if not auto_tweet:
            status = "New #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )
        else:
            status = auto_tweet.replace("*MYHANDLE*", tw.tw_handle)
            if startup.q4:
                status = status.replace("*SUHANDLE*", startup.q4)
            else:
                status = status.replace("*SUHANDLE*", '')

            if tw.tw_short_url:
                status = status.replace("*SHORTURL*", tw.tw_short_url)
            else:
                if tw.tw_handle:
                    status = status.replace("*SHORTURL*", tw.tw_handle)
                else:
                    status = status.replace("*SHORTURL*", '')
            status = status.replace("*SUNAME*", startup.q1)

        # if startup.q4:
        #     if int(startup.q2) == year:
        #         status = "New #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )
        #     else:
        #         status = "Featured #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )
        # else:
        #     if int(startup.q2) == year:
        #         status = "New #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )
        #     else:
        #         status = "Featured #startup on %s: %s via %s" % ( tw.tw_short_url, startup.q4, tw.tw_handle )

        try:
            tweet(status)
        except tweepy.TweepError as e:
            logging.error(e.response.status)


        self.redirect("/dashboard/logo")