python 3.8
curl 'https://www.epicgames.com/store/backend/graphql-proxy' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Referer: https://www.epicgames.com/store/en-US/' -H 'Content-Type: application/json;charset=utf-8' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Cookie: EPIC_SESSION_DIESEL=TSKOhfkmgpcBFbah7OnIyg.K9_nsiIaB0wCuz2xfF7y1P4yCO5sOlZD6XDfWtSQ6wtEUd9sEar8Kw66efDWY6MU.1587536135267.86400000.PMIBn3vm-S_GRIkKFqDyy49_UKoFJ50y9Zt0LI_cmf0; EPIC_LOCALE_COOKIE=en-US' --data '{"query":"query searchStoreQuery($allowCountries: String, $category: String, $count: Int, $country: String!, $keywords: String, $locale: String, $namespace: String, $sortBy: String, $sortDir: String, $start: Int, $tag: String, $withPrice: Boolean = false, $withPromotions: Boolean = false) {\n Catalog {\n searchStore(allowCountries: $allowCountries, category: $category, count: $count, country: $country, keywords: $keywords, locale: $locale, namespace: $namespace, sortBy: $sortBy, sortDir: $sortDir, start: $start, tag: $tag) {\n elements {\n title\n id\n namespace\n description\n effectiveDate\n keyImages {\n type\n url\n }\n seller {\n id\n name\n }\n productSlug\n urlSlug\n url\n items {\n id\n namespace\n }\n customAttributes {\n key\n value\n }\n categories {\n path\n }\n price(country: $country) @include(if: $withPrice) {\n totalPrice {\n discountPrice\n originalPrice\n voucherDiscount\n discount\n currencyCode\n currencyInfo {\n decimals\n }\n fmtPrice(locale: $locale) {\n originalPrice\n discountPrice\n intermediatePrice\n }\n }\n lineOffers {\n appliedRules {\n id\n endDate\n discountSetting {\n discountType\n }\n }\n }\n }\n promotions(category: $category) @include(if: $withPromotions) {\n promotionalOffers {\n promotionalOffers {\n startDate\n endDate\n discountSetting {\n discountType\n discountPercentage\n }\n }\n }\n upcomingPromotionalOffers {\n promotionalOffers {\n startDate\n endDate\n discountSetting {\n discountType\n discountPercentage\n }\n }\n }\n }\n }\n paging {\n count\n total\n }\n }\n }\n}\n","variables":{"category":"freegames","sortBy":"effectiveDate","sortDir":"asc","count":1000,"country":"US","allowCountries":"US","locale":"en-US","withPrice":true,"withPromotions":true}}'
import requests
cookies = {
'EPIC_SESSION_DIESEL': 'TSKOhfkmgpcBFbah7OnIyg.K9_nsiIaB0wCuz2xfF7y1P4yCO5sOlZD6XDfWtSQ6wtEUd9sEar8Kw66efDWY6MU.1587536135267.86400000.PMIBn3vm-S_GRIkKFqDyy49_UKoFJ50y9Zt0LI_cmf0',
'EPIC_LOCALE_COOKIE': 'en-US',
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': "gzip, deflate, br",
'Referer': 'https://www.epicgames.com/store/en-US/',
'Content-Type': 'application/json;charset=utf-8',
'X-Requested-With': 'XMLHttpRequest',
'Connection': 'keep-alive',
}
import json
data = """{"query":"query searchStoreQuery($allowCountries: String, $category: String, $count: Int, $country: String!, $keywords: String, $locale: String, $namespace: String, $sortBy: String, $sortDir: String, $start: Int, $tag: String, $withPrice: Boolean ': ' false, $withPromotions: Boolean = false) {\\n Catalog {\\n searchStore(allowCountries: $allowCountries, category: $category, count: $count, country: $country, keywords: $keywords, locale: $locale, namespace: $namespace, sortBy: $sortBy, sortDir: $sortDir, start: $start, tag: $tag) {\\n elements {\\n title\\n id\\n namespace\\n description\\n effectiveDate\\n keyImages {\\n type\\n url\\n }\\n seller {\\n id\\n name\\n }\\n productSlug\\n urlSlug\\n url\\n items {\\n id\\n namespace\\n }\\n customAttributes {\\n key\\n value\\n }\\n categories {\\n path\\n }\\n price(country: $country) @include(if: $withPrice) {\\n totalPrice {\\n discountPrice\\n originalPrice\\n voucherDiscount\\n discount\\n currencyCode\\n currencyInfo {\\n decimals\\n }\\n fmtPrice(locale: $locale) {\\n originalPrice\\n discountPrice\\n intermediatePrice\\n }\\n }\\n lineOffers {\\n appliedRules {\\n id\\n endDate\\n discountSetting {\\n discountType\\n }\\n }\\n }\\n }\\n promotions(category: $category) @include(if: $withPromotions) {\\n promotionalOffers {\\n promotionalOffers {\\n startDate\\n endDate\\n discountSetting {\\n discountType\\n discountPercentage\\n }\\n }\\n }\\n upcomingPromotionalOffers {\\n promotionalOffers {\\n startDate\\n endDate\\n discountSetting {\\n discountType\\n discountPercentage\\n }\\n }\\n }\\n }\\n }\\n paging {\\n count\\n total\\n }\\n }\\n }\\n}\\n","variables":{"category":"freegames","sortBy":"effectiveDate","sortDir":"asc","count":1000,"country":"US","allowCountries":"US","locale":"en-US","withPrice":true,"withPromotions":true}
}"""
response = requests.post('https://www.epicgames.com/store/backend/graphql-proxy', headers=headers, cookies=cookies, data=data)
print(response, response.content)
Казалось бы, эквивалетно, но в случае с python
неожиданно не работает. В чем может быть причина?
Вывод в консоль:
b'Request failed with status code 400'