vrchatapi/vrchatapi-python

403 with anything in instances_api

TheUnifox opened this issue · 3 comments

I dont know what im doing wrong, but i get vrchatapi.exceptions.ForbiddenException: (403) Reason: Forbidden then a big long http response header
here is what i have:

import time
from vrchatapi.api import authentication_api, worlds_api, instances_api
from vrchatapi import rest
import os

UserID = 'usr_2c4c5239-ca74-45fd-8f67-844c9bae8bd7'

configuration = vrchatapi.Configuration(
		username = 'goldngamr5',
		password = os.environ['PASSWORD']
)
with vrchatapi.ApiClient(configuration) as api_client:
	AAPI = authentication_api.AuthenticationApi(api_client)
	user = AAPI.get_current_user()
	print(user['id'])
	WAPI = worlds_api.WorldsApi(api_client)
	worlds = WAPI.search_worlds(search='Furhub')
	print(worlds[0]['id'])
	IAPI = instances_api.InstancesApi(api_client)

	NumOfInst = 5
	InstanceIDs = list()
	while NumOfInst != 0:
		InstanceID = '69420-'+str(NumOfInst)+'~private('+UserID+')~region(us)~nonce(ef8ac1e7-ad10-418b-829f-be9dcb07133a)'
		NumOfInst -= 1
		print(InstanceID)
		InstanceIDs.append(InstanceID)
	time.sleep(2)
	instance = IAPI.send_self_invite(world_id='wrld_65ce4a4b-f66f-4844-adfe-072663394514', instance_id='69420~private(usr_1c84fd71-365d-4601-b10c-76a26020364a)~region(us)~nonce(ef8ac1e7-ad10-418b-829f-be9dcb07133a)')
	print(instance)```

here is the whole output:

wrld_65ce4a4b-f66f-4844-adfe-072663394514
69420-5~private(usr_2c4c5239-ca74-45fd-8f67-844c9bae8bd7)~region(us)~nonce(ef8ac1e7-ad10-418b-829f-be9dcb07133a)
69420-4~private(usr_2c4c5239-ca74-45fd-8f67-844c9bae8bd7)~region(us)~nonce(ef8ac1e7-ad10-418b-829f-be9dcb07133a)
69420-3~private(usr_2c4c5239-ca74-45fd-8f67-844c9bae8bd7)~region(us)~nonce(ef8ac1e7-ad10-418b-829f-be9dcb07133a)
69420-2~private(usr_2c4c5239-ca74-45fd-8f67-844c9bae8bd7)~region(us)~nonce(ef8ac1e7-ad10-418b-829f-be9dcb07133a)
69420-1~private(usr_2c4c5239-ca74-45fd-8f67-844c9bae8bd7)~region(us)~nonce(ef8ac1e7-ad10-418b-829f-be9dcb07133a)
Traceback (most recent call last):
  File "main.py", line 30, in <module>
    instance = IAPI.send_self_invite(world_id='wrld_65ce4a4b-f66f-4844-adfe-072663394514', instance_id='69420~private(usr_1c84fd71-365d-4601-b10c-76a26020364a)~region(us)~nonce(ef8ac1e7-ad10-418b-829f-be9dcb07133a)')
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/vrchatapi/api/instances_api.py", line 424, in send_self_invite
    return self.send_self_invite_endpoint.call_with_http_info(**kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/vrchatapi/api_client.py", line 834, in call_with_http_info
    return self.api_client.call_api(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/vrchatapi/api_client.py", line 408, in call_api
    return self.__call_api(resource_path, method,
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/vrchatapi/api_client.py", line 202, in __call_api
    raise e
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/vrchatapi/api_client.py", line 195, in __call_api
    response_data = self.request(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/vrchatapi/api_client.py", line 454, in request
    return self.rest_client.POST(url,
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/vrchatapi/rest.py", line 281, in POST
    return self.request("POST", url,
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/vrchatapi/rest.py", line 232, in request
    raise ForbiddenException(http_resp=r)
vrchatapi.exceptions.ForbiddenException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 18 Mar 2022 20:26:26 GMT', 'Content-Type': 'text/html; charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-Frame-Options': 'SAMEORIGIN', 'Referrer-Policy': 'same-origin', 'Cache-Control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Expires': 'Thu, 01 Jan 1970 00:00:01 GMT', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Vary': 'Accept-Encoding', 'Server': 'cloudflare', 'CF-RAY': '6ee0b4098ee3c534-ORD'})
HTTP response body: <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>Access denied | api.vrchat.cloud used Cloudflare to restrict access</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/main.css" type="text/css" media="screen,projection" />
<script type="text/javascript">
(function(){if(document.addEventListener&&window.XMLHttpRequest&&JSON&&JSON.stringify){var e=function(a){var c=document.getElementById("error-feedback-survey"),d=document.getElementById("error-feedback-success"),b=new XMLHttpRequest;a={event:"feedback clicked",properties:{errorCode:1020,helpful:a,version:1}};b.open("POST","https://sparrow.cloudflare.com/api/v1/event");b.setRequestHeader("Content-Type","application/json");b.setRequestHeader("Sparrow-Source-Key","c771f0e4b54944bebf4261d44bd79a1e");
b.send(JSON.stringify(a));c.classList.add("feedback-hidden");d.classList.remove("feedback-hidden")};document.addEventListener("DOMContentLoaded",function(){var a=document.getElementById("error-feedback"),c=document.getElementById("feedback-button-yes"),d=document.getElementById("feedback-button-no");"classList"in a&&(a.classList.remove("feedback-hidden"),c.addEventListener("click",function(){e(!0)}),d.addEventListener("click",function(){e(!1)}))})}})();
</script>
<script defer src="https://api.radar.cloudflare.com/beacon.js"></script>
</head>
<body>
<div id="cf-wrapper">
<div class="cf-alert cf-alert-error cf-cookie-error hidden" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>
<div id="cf-error-details" class="p-0">
<header class="mx-auto pt-10 lg:pt-6 lg:px-8 w-240 lg:w-full mb-15 antialiased">
<h1 class="inline-block md:block mr-2 md:mb-2 font-light text-60 md:text-3xl text-black-dark leading-tight">
<span data-translate="error">Error</span>
<span>1020</span>
</h1>
<span class="inline-block md:block heading-ray-id font-mono text-15 lg:text-sm lg:leading-relaxed">Ray ID: 6ee0b4098ee3c534 &bull;</span>
<span class="inline-block md:block heading-ray-id font-mono text-15 lg:text-sm lg:leading-relaxed">2022-03-18 20:26:26 UTC</span>
<h2 class="text-gray-600 leading-1.3 text-3xl lg:text-2xl font-light">Access denied</h2>
</header>
<section class="w-240 lg:w-full mx-auto mb-8 lg:px-8">
<div id="what-happened-section" class="w-1/2 md:w-full">
<h2 class="text-3xl leading-tight font-normal mb-4 text-black-dark antialiased" data-translate="what_happened">What happened?</h2>
<p>This website is using a security service to protect itself from online attacks.</p>
</div>
</section>
<div class="feedback-hidden py-8 text-center" id="error-feedback">
<div id="error-feedback-survey">
Was this page helpful?
<button class="border border-solid bg-white cf-button cursor-pointer ml-4 px-4 py-2 rounded" id="feedback-button-yes" type="button">Yes</button>
<button class="border border-solid bg-white cf-button cursor-pointer ml-4 px-4 py-2 rounded" id="feedback-button-no" type="button">No</button>
</div>
<div class="feedback-success feedback-hidden" id="error-feedback-success">
Thank you for your feedback!
</div>
</div>
<div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
<p class="text-13">
<span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">6ee0b4098ee3c534</strong></span>
<span class="cf-footer-separator sm:hidden">&bull;</span>
<span class="cf-footer-item sm:block sm:mb-1"><span>Your IP</span>: 35.232.178.115</span>
<span class="cf-footer-separator sm:hidden">&bull;</span>
<span class="cf-footer-item sm:block sm:mb-1"><span>Performance &amp; security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link" target="_blank">Cloudflare</a></span>
</p>
</div>
</div>
</div>
<script type="text/javascript">
  window._cf_translation = {};
  
  
</script>
</body>
</html>```

35.232.178.115 belongs to AS15169 which is Google Cloud. VRChat has temporarily blacklisted requests coming from popular server hosting sites like Heztner, Google and OVH.

Please try run the code from your home network instead.

ah ok, i have it running on a site called replit. ty