Also I'm banging my head against the wall ``` # fn...
# ask-community
j
Also I'm banging my head against the wall
Copy code
# fnPortfolioOptimization()
from prefect import Client
client = Client(api_token = %TOKEN%)
client.login_to_tenant(tenant_slug='pwcm')

with Flow('test2') as flow:
    lookback_periods = Parameter("lookback_periods", default=[3, 5, 7])
    percent_change = Parameter("percent_change", default = [.05, 0.07, 0.1])
    lookback_days_rsi = Parameter("lookback_days_rsi", default = 20)
    rsi_overbought = Parameter("rsi_overbought", default=0.75)

    fnRunAlgo(lookback_periods, percent_change, lookback_days_rsi, rsi_overbought)
prefect.utilities.exceptions.ClientError: Malformed response received from Cloud - please ensure that you have an API token properly configured. I've tried a custom service-account token, as well as my user api key, neither work when calling flow.register(project_name) or client.register(flow, project_name)
k
Hey @Joseph Loss! Was this working before and then it stopped working? Can you login with the command line using
prefect auth login -t %TOKEN%
?
You may have stale tokens lying around and shouldn’t be calling the login method.
client = Client()
will automatically log-in if you configured with the command line. To clear potentially stale tokens, you can do
rm -rf ~/.prefect/client
j
ah gotchya, so this has always worked for me but now I'm trying to do this in a docker container to register / setup a flows with Prefect for a freelance client o' mine
But the good news is, I have a nice and neat little gist I'll post right here that did the trick!
k
Gotcha! Glad you have something working