Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
fooddata15
Frequent Visitor

Please wait while we establish a connection to python

I've reinstalled Python 3.96/windows and can't seem to have any luck running this script. I just get the "Please wait while we establish a connection to python" spinning window that never changes. Any ideas?

P.S. Yes, I did put in the correct authorization info in the headers 🙂

 

 

 

import requests
import json

def get_all_time_entries():

    url_address = "https://api.harvestapp.com/v2/time_entries"  
    headers = {
        "Authorization": "Bearer " + "xxxxxxxxxx",
        "Harvest-Account-ID": "xxxxxx"
    }

    # find out total number of pages
    r = requests.get(url=url_address, headers=headers).json()
    total_pages = int(r['total_pages'])

    # results will be appended to this list
    all_time_entries = []

    # loop through all pages and return JSON object
    for page in range(1, total_pages):

        url = "https://api.harvestapp.com/v2/time_entries?page="+str(page)              
        response = requests.get(url=url, headers=headers).json()        
        all_time_entries.append(response)       
        page += 1

    # prettify JSON
    data = json.dumps(all_time_entries, sort_keys=True, indent=4)

    return data

print(get_all_time_entries())

 

 

3 REPLIES 3
fooddata15
Frequent Visitor

No resolution... ultimately I ran on another machine to test and still had query issues even after making sure all additional packages were in.

v-rzhou-msft
Community Support
Community Support

Hi @fooddata15 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your problem.

 

Best Regards,

Rico Zhou

v-rzhou-msft
Community Support
Community Support

Hi @fooddata15 

Currently you have installed Python 3.96/windows , when you connect to data source by python, it alway show loading.

1. Please check your network setting, the fire wall and check .Net in your PC.

2. Please download the latest version of Power BI Desktop and try again.

Link: Download Microsoft Power BI Desktop from Official Microsoft Download Center

3. According to your code, I think you may want to get data by Rest API. You can try to connect to Rest API by Web connector.

For Reference: Using a REST API as a data source

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.