Skip to content

Empty URLs When making Async Request #272

@seanpdwyer7

Description

@seanpdwyer7

When running through an async request with the following script:

 queued_job_ids = []
        try:
            for chunk_ids in split_list(ids, 20):
                queued_job_ids.append(PromotedTweet.queue_async_stats_job(account, chunk_ids, metric_groups,placement = placement, granularity = granularity, start_time = start_time, end_time = end_time).id)
                print(chunk_ids)
        except:
            pass

        print(queued_job_ids)

        time.sleep(30)
        try:
            async_stats_job_results = PromotedTweet.async_stats_job_result(account, job_ids=queued_job_ids)
        except:
            pass

async_data = []
        count=0
        for result in async_stats_job_results:
            #time.sleep(15)
            count+=1
            print(count)
            url = result.url
            print(async_stats_job_results)
            print(url)
            print(result)
            try:
                async_data.append(PromotedTweet.async_stats_job_data(account, url=url))
            except:
                pass

I'm getting the following URL response:

<twitter_ads.cursor.Cursor object at xxxxxx>
None
<Analytics resource at xxxxxx id=xxxxx>

I've seen this happen before and I assume it's latency on Twitter's server-side that is delaying the report longer than what I am waiting for it to be returned.

I'm wondering if anyone else has seen Twitter return empty URLs when making a request and what you've done to ensure that each request has a JSON file that's returned?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions