Closed Suman46 closed 5 years ago
Thanks for you contact @suman46.
I will improve this error message and update the documentation.
ValueError: Response from: http://X.X.X.X:8088/api/v1/test-profile.yml was different than 200.`
The error reported occur because the response code status is different than 200 for the requested URL.
Can you access this address in your browser or via curl, for example?
I observed that you are trying to access the configuration on yml format, but in this version this format is not supported. I will evaluate the possibilitie to add this feature in a new version. For now change test-profile.yml
to test-profile.json
.
I have included below an example of using config-client with configserver sample available in the spring-cloud-examples.
After running the application you can run the code below to retrieve the configurations.
from config.spring import ConfigServer
c = ConfigServer(
app_name='foo',
profile='development',
address='http://localhost:8888',
branch='master',
url='{address}/{branch}/{app_name}-{profile}.json'
)
c.url # this property will display the target URL
c.get_config() # request to retrieve application's configuration
c.config # display the configurations retrieved
c.get_attribute('democonfigclient.message') # access a property
I'm using spring boot 2.0.2.RELEASE which acts as my configuration server which exposes GET API and python client to read configuration from spring server but python client fails to get the configuration. Spring Config Server Log:
INFO 11670 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/{label}/{name}-{profiles}.yml || /{label}/{name}-{profiles}.yaml],methods=[GET]}" onto public org.springframework.http.ResponseEntity<java.lang.String> org.springframework.cloud.config.server.environment.EnvironmentController.labelledYaml(java.lang.String,java.lang.String,java.lang.String,boolean) throws java.lang.Exception
Inorder to get the configuration file (test-profile.yml) which consitsmanagement.baseurl: http://192.168.0.0:8096
Approach : `(virtual-env) [sample]$ python3.7 Python 3.7.3 (default, Jul 31 2019, 14:24:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux Type "help", "copyright", "credits" or "license" for more information.
May I know what is the actual error message ??
More details on issue please refer : https://stackoverflow.com/questions/57307808/python-client-config-client-0-3-1-to-get-yml-configuration-from-spring-boot-co