# Python 'request' contains errors and does not match my settings

**URL:** <https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303>\
**Category:** Help Hub\
**Tags:** documentation\
**Created:** [November 27, 2019, 11:43pm UTC](https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303 "2019-11-27T23:43:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanKRose](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@DanKRose](https://community.postman.com/u/DanKRose)\
**Post date:** [November 27, 2019, 11:43pm UTC](https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303/1 "2019-11-27T23:43:37Z")

</div>

The ‘Published’ Python sample code contains errors with default settings. Additionally, when I edited my Python Request settings to correct the updated values were not carried into the new Publication.

The first issue is that my users reported errors while using the sample Python Request code snippets. They found the following:

```auto
import requests
url = 'https://api.scriptsasiaonline.com/v2/auth/login'
payload = "{\n\t\"username\": \"{{SA_api_username}}\",\n\t\"password\": \"{{SA_api_password}}\"\n}"
headers = {
  'Content-Type': 'application/x-www-form-urlencoded'
}
response = requests.request('POST', url, headers = headers, data = payload, allow_redirects=False, timeout=undefined, allow_redirects=false)
print(response.text)

```

- “Allow\_redirects=False” is in the request function twice, so it returns a “Keyword argument repeated” error -\> fixed if only one of it is there; delete the one at the end
- “timeout=undefined” I couldn’t find “undefined” as a valid preset input anywhere online, so it looks like it’s trying to find “undefined” as a variable -\> “None” is a valid input for the timeout keyword if we want to use that as a sample

The second issue is when alerted to this I customized the configuration in the documentation to set the timeout values and to turn-off redirect. Which resulted in the following:

```auto
import requests 

url = "https://{{SA_api_hostname}}/{{SA_api_env}}/update/persons" 
payload = {} 
headers = { 'authorizationToken': '{{SA_AuthenticationToken}}', 'x-api-key': '{{SA_api-key}}' 
} 
response = requests.request("GET", url, headers=headers, data = payload, allow_redirects = False, timeout=1000) 
print(response.text.encode('utf8'))

```

When I unpublished and RE-published the API the _new_ values did not show up in the publication.

You can view for yourself here -\> [https://documenter.getpostman.com/view/6848098/SW12zHUX?version=latest#intro](https://documenter.getpostman.com/view/6848098/SW12zHUX?version=latest#intro)

Thank you in advance for any assistance with this. We love using Postman to communication with our clients on the latest updates with solid examples.

Dan

---

<div class="post-metadata">

**Author:** ![arlem](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/arlem/32/3078_2.png) [@arlem](https://community.postman.com/u/arlem)\
**Post date:** [December 3, 2019, 11:01am UTC](https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303/2 "2019-12-03T11:01:39Z")

</div>

Hi @DanKRose and welcome here! 😃

Which version of Postman are you using? I’m on `7.12.0` and couldn’t reproduce that. This was a known bug in previous versions but has been fixed since I believe.

---

<div class="post-metadata">

**Author:** ![DanKRose](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@DanKRose](https://community.postman.com/u/DanKRose)\
**Post date:** [December 3, 2019, 12:03pm UTC](https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303/3 "2019-12-03T12:03:35Z")

</div>

Arlemi,

Thank you for looking at my request. Funny (not really funny) thing just happened when I opened Postman to check the version.

I received a message, bottom right of screen, that my version has been updated to 7.12.0. So that would seem like a good sign if what your suggesting as an old bug was the root of my issue.

Bad thing though is that it appears my environment has LOST the updates I’ve done to the my API completely post Sept 2019. So basically, all of my work has been lost. I’ve been working on this for the past few months and several versions of the api documented and released.

The published version, V2, is still published but the source code is no longer present in my Team Workspace. Any thoughts?

-Dan

---

<div class="post-metadata">

**Author:** ![francis](https://avatars.discourse-cdn.com/v4/letter/f/ac8455/32.png) [@francis](https://community.postman.com/u/francis)\
**Post date:** [December 3, 2019, 1:40pm UTC](https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303/4 "2019-12-03T13:40:26Z")

</div>

Hi Dan,

Sorry to hear about the loss of your recent updates. Would you please navigate to the links below and confirm if you find your updated data or not:

[https://go.postman.co/me/environments](https://go.postman.co/me/environments) - Environments  
[https://go.postman.co/me/collections](https://go.postman.co/me/collections) - Personal collection  
[https://go.postman.co/team/elements?type=collection](https://go.postman.co/team/elements?type=collection) - Team collection  
[https://go.postman.co/me/collections?view=all](https://go.postman.co/me/collections?view=all) - All collections

---

<div class="post-metadata">

**Author:** ![DanKRose](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@DanKRose](https://community.postman.com/u/DanKRose)\
**Post date:** [December 3, 2019, 2:01pm UTC](https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303/5 "2019-12-03T14:01:18Z")

</div>

Hello, Francis.

Thank you for the quick review.  
Environments = All instances listed however the value for the variables are all empty. I suspect this is expected but as an fyi if that means anything to you.  
My Collections = All instances are listed.  
Team Collections = All instances (I’m the primary dev so most are the same).  
All Collections = All are listed.

So they exist in the cloud but how would I link them back into my locally installed Postman app?

Thanks in advance for your attention to this.

-Dan

---

<div class="post-metadata">

**Author:** ![arlem](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/arlem/32/3078_2.png) [@arlem](https://community.postman.com/u/arlem)\
**Post date:** [December 3, 2019, 3:32pm UTC](https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303/6 "2019-12-03T15:32:14Z")

</div>

Could you open a support ticket using the `Submit a Ticket` button on that page?  
[https://www.getpostman.com/support](https://www.getpostman.com/support)

The support team should hopefully be able to walk you through recovering your data on your local instance. 🙂

---

<div class="post-metadata">

**Author:** ![spacecraft-architec9](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/spacecraft-architec9/32/31427_2.png) [@spacecraft-architec9](https://community.postman.com/u/spacecraft-architec9)\
**Post date:** [January 25, 2025, 9:17am UTC](https://community.postman.com/t/python-request-contains-errors-and-does-not-match-my-settings/9303/7 "2025-01-25T09:17:03Z")

</div>

Hey Dan,

Are you issue is resolved?  
I’m facing the same problem, can you suggest me the steps you followed?

- Avdhesh
