2424import json
2525from typing import NamedTuple
2626
27- import requests
27+ import cloudscraper
2828
2929from epicstore_api .exc import EGSException , EGSNotFound
3030from epicstore_api .models import EGSCategory , EGSCollectionType , EGSProductType
@@ -72,7 +72,8 @@ def __init__(self, locale="en-US", country="US", session=None) -> None:
7272 """:param locale: EGS locale (this parameter depends on responses locale)
7373 :param country: EGS country
7474 """
75- self ._session = requests .Session () or session
75+ self ._session = session or cloudscraper .create_scraper ()
76+ self ._graphql_url = "https://store.epicgames.com/graphql"
7677 self .locale = locale
7778 self .country = country
7879
@@ -437,7 +438,7 @@ def _make_graphql_query(
437438 variables .update ({'locale' : self .locale , 'country' : self .country })
438439 # This variables are default and exist in all graphql queries
439440 response = self ._session .post (
440- 'https://graphql.epicgames.com/graphql' ,
441+ self . _graphql_url ,
441442 json = {'query' : query_string , 'variables' : variables },
442443 headers = headers ,
443444 ).json ()
@@ -451,7 +452,7 @@ def _make_graphql_query(
451452 variables_ .update (variables )
452453 data .append ({'query' : query_string , 'variables' : variables_ })
453454 response = self ._session .post (
454- 'https://graphql.epicgames.com/graphql' ,
455+ self . _graphql_url ,
455456 json = data ,
456457 headers = headers ,
457458 ).json ()
0 commit comments