Pump Fun Api and Python Request issue

Hello this is my first time using bitquery and I was having some errors with my request function. Sorry I know this is probably a very trivial error if any one can spot it that would be much appreciated. When I run the python code I get this response {“data”:null,“errors”:[{“message”:“Cannot query field "Solana" on type "RootQuery".”,“locations”:[{“line”:3,“column”:9}]}]}

how can I get it to properly return the top coins on pump fun on solana ?

import requests
import json

def request():
    access_token = 'myRealApiKeyHere'

    # Step 2: Make Streaming API query
    url_graphql = "https://streaming.bitquery.io/graphql"
    headers_graphql = {
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {access_token}'
    }

    graphql_query = '''
    {
        Solana {
            DEXTrades(
                limitBy: {
                    by: Trade_Buy_Currency_MintAddress
                    count: 1
                }
                orderBy: { descending: Trade_Buy_Price }
                where: {
                    Trade: { Dex: { ProtocolName: { is: "pump" } } }
                    Buy: {
                        Currency: {
                            MintAddress: {
                                notIn: ["11111111111111111111111111111111"]
                            }
                        }
                    }
                    Transaction: { Result: { Success: true } }
                }
            ) {
                Trade {
                    Buy {
                        Price
                        PriceInUSD
                        Currency {
                            Name
                            Symbol
                            MintAddress
                            Decimals
                            Fungible
                            Uri
                        }
                    }
                }
            }
        }
    }
    '''

    payload_graphql = json.dumps({'query': graphql_query})

    # Step 3: Make request to Streaming API
    response_graphql = requests.post(url_graphql, headers=headers_graphql, data=payload_graphql)

    # Print the response
    print(response_graphql.text)

request()







1 Like
[https://sharesight.com/masoudahmadi's portfolio ](https://sharesight.com/masoudahmadi's portfolio )
[date-range from=2024-08-23 to=2024-09-27T07:45:00 format="LL" timezone="Asia/Tehran" timezones="Iran|Turkey|America/Tijuana|Africa/Accra|Africa/Algiers"]

```https://community.bitquery.io/t/pump-fun-api-and-python-request-issue/2041/2?u=masoudahg

[> Blockquote](https://community.bitquery.io/t/working-java-sample-for-subscribing-to-bitquery-with-without-parameters/1613)

@scotsoradis121 url should be https://streaming.bitquery.io/eap

1 Like

thanks for the suggestion it worked

1 Like