0

I am using Requests module with REST API. Attempted to delete TeamCity build configuration and caught into 401 client error. curl works, see below.

curl -u admin:password -X DELETE url

But not through Requests delete() method, see below.

requests.delete(url)

Example of url is https://teamcity_server/app/rest/buildTypes/build_id

CarolL
  • 59
  • 2
  • 8

1 Answers1

2

401 status code means your request is unauthorized. In curl you give user:password but not in requests.delete(url). You can pass authentication parameters to requests functions in this way:

request.delete(url, auth=('admin', 'password'))
P.Ezzati
  • 178
  • 1
  • 8
  • Thanks, it works! However, using the previous approach (without auth) works for deleting parameter setting. Any thought would be appreciated. – CarolL Nov 14 '19 at 05:43