subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 685 forks source link

URL host invalid, top level domain required (type=value_error.url.host) #102

Closed mikebgrep closed 3 years ago

mikebgrep commented 3 years ago

File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/private.py", line 205, in _send_private_request response.raise_for_status() File "/home/pc/instagramBot/api/api_new/lib/python3.6/site-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/accounts/login/

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.6/tkinter/init.py", line 1705, in call return self.func(*args) File "gui_update.py", line 114, in go self.start_hashtag() File "gui_update.py", line 141, in start_hashtag cl.login(ACCOUNT_USERNAME, ACCOUNT_PASSWORD) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/auth.py", line 343, in login if self.private_request("accounts/login/", data, login=True): File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/private.py", line 338, in private_request raise e File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/private.py", line 325, in private_request self._send_private_request(endpoint, kwargs) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/private.py", line 245, in _send_private_request raise SentryBlock(last_json) instagrapi.exceptions.SentryBlock: Sorry, there was a problem with your request. Bot login with username: @technogoons

1 validation error for User external_url URL host invalid, top level domain required (type=value_error.url.host) Traceback (most recent call last): File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/user.py", line 181, in user_info_by_username user = self.user_info_by_username_gql(username) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/user.py", line 136, in user_info_by_username_gql return extract_user_gql(self.public_a1_request(f"/{username!s}/")["user"]) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/extractors.py", line 145, in extract_user_gql data, File "pydantic/main.py", line 362, in pydantic.main.BaseModel.init pydantic.error_wrappers.ValidationError: 1 validation error for User external_url URL host invalid, top level domain required (type=value_error.url.host) Exception in Tkinter callback Traceback (most recent call last): File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/user.py", line 181, in user_info_by_username user = self.user_info_by_username_gql(username) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/user.py", line 136, in user_info_by_username_gql return extract_user_gql(self.public_a1_request(f"/{username!s}/")["user"]) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/extractors.py", line 145, in extract_user_gql data, File "pydantic/main.py", line 362, in pydantic.main.BaseModel.init pydantic.error_wrappers.ValidationError: 1 validation error for User external_url URL host invalid, top level domain required (type=value_error.url.host)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.6/tkinter/init.py", line 1705, in call return self.func(*args) File "gui_update.py", line 114, in go self.start_hashtag() File "gui_update.py", line 156, in start_hashtag user_Id = cl.user_id_from_username(each) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/user.py", line 42, in user_id_from_username return int(self.user_info_by_username(username).pk) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/user.py", line 189, in user_info_by_username user = self.user_info_by_username_v1(username) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/mixins/user.py", line 160, in user_info_by_username_v1 return extract_user_v1(result["user"]) File "/home/pc/instagramBot/api/api_new/src/instagrapi/instagrapi/extractors.py", line 152, in extract_user_v1 return User(**data) File "pydantic/main.py", line 362, in pydantic.main.BaseModel.init pydantic.error_wrappers.ValidationError: 1 validation error for User external_url URL host invalid, top level domain required (type=value_error.url.host) ^CTraceback (most recent call last):

Hereis my code: user_Id = cl.user_id_from_username(each)

mikebgrep commented 3 years ago

I make change to the code not too much repeated actions