How to freeze component in langflow interface via python api? #3257
Unanswered
LeeMoofon0222
asked this question in
Q&A
Replies: 1 comment 8 replies
-
The Here is an updated version of your code that includes the necessary headers for authentication, which might be required: import requests
def freeze(component_id, api_key):
api_url = f"http://127.0.0.1:7860/api/v1/components/{component_id}"
# Payload to update the frozen attribute
payload = {
"node": {
"frozen": True
}
}
# Headers for authentication
headers = {
'Content-Type': 'application/json',
'x-api-key': api_key
}
# Send the request to update the component
response = requests.patch(api_url, json=payload, headers=headers)
print(response)
if response.status_code == 200:
print("Component frozen successfully.")
else:
print(f"Failed to freeze the component. Status code: {response.status_code}, Response: {response.text}")
# Example usage
freeze("OpenAIModel-1pAyL", "your_api_key_here") Make sure to replace |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I was tring to freeze my component OpenAIModel-1pAyL. But I found that this way doesn't work. The response code is:
response: 405 Method Not Allowed
And here is my code:
Beta Was this translation helpful? Give feedback.
All reactions