Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The set_settings() method ignores the country key when setting settings from the dictionary #2065

Open
obervinov opened this issue Nov 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@obervinov
Copy link

obervinov commented Nov 19, 2024

Describe the bug
When I set the instance settings via dictionary in the set_settings() method, all parameters are assigned correctly except country. Instead, the default value from the module code is set to US.

To Reproduce

  1. Create a dictionary with session configuration
from instagrapi import Client

client = Client()
config = {
    "country": "UK",
    "country_code": 1,
    "locale": "en_US",
    "timezone_offset": 3600
}
client.set_settings(config)
  1. Get the parameters of the current session configuration
print(client.get_settings())

{'uuids': {...}, 'mid': None, 'ig_u_rur': None, 'ig_www_claim': None, 'authorization_data': {}, 'cookies': {}, 'last_login': None, 'device_settings': {...}, 'user_agent': '...', 'country': 'US', 'country_code': 1, 'locale': 'en_US', 'timezone_offset': 3600}
  1. If I explicitly call the set_country() method it works
client.set_country('UK')
print(client.get_settings())

{'uuids': {...}, 'mid': None, 'ig_u_rur': None, 'ig_www_claim': None, 'authorization_data': {}, 'cookies': {}, 'last_login': None, 'device_settings': {...}, 'user_agent': '...', 'country': 'UK', 'country_code': 1, 'locale': 'en_US', 'timezone_offset': 3600}

Traceback
None

Expected behavior
I expect that all dictionary keys passed to client.set_settings() will be propagated to the session attributes.

Screenshots
None

Desktop (please complete the following information):

  • OS: Ubuntu 21.04
  • Python version 3.12.7
  • instagrapi version 2.1.2

Additional context
Also client.load_settings() ignores the country dictionary key saved via client.dump_settings()

@obervinov obervinov added the bug Something isn't working label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant